CbmRoot
Loading...
Searching...
No Matches
CbmStar2019MonitorTof.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2021 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// ----- CbmStar2019MonitorTof -----
8// ----- Created 10.07.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
14#include "CbmHistManager.h"
15#include "CbmStar2019TofPar.h"
16
17#include "FairRootManager.h"
18#include "FairRun.h"
19#include "FairRunOnline.h"
20#include "FairRuntimeDb.h"
21#include <Logger.h>
22
23#include "Rtypes.h"
24#include "TCanvas.h"
25#include "TClonesArray.h"
26#include "TF1.h"
27#include "TH1.h"
28#include "TH2.h"
29#include "THStack.h"
30#include "THttpServer.h"
31#include "TMath.h"
32#include "TPaveStats.h"
33#include "TProfile.h"
34#include "TProfile2D.h"
35#include "TROOT.h"
36#include "TString.h"
37#include "TStyle.h"
38
39#include <algorithm>
40#include <ctime>
41#include <iomanip>
42#include <iostream>
43
44#include <stdint.h>
45
47Bool_t bMcbmMoniTofSaveHistos = kFALSE;
52
55 , fvMsComponentsList()
56 , fuNbCoreMsPerTs(0)
57 , fuNbOverMsPerTs(0)
58 , fbIgnoreOverlapMs(kFALSE)
59 , fuMsAcceptsPercent(100)
60 , fuTotalMsNb(0)
61 , fuOverlapMsNb(0)
62 , fuCoreMs(0)
63 , fdMsSizeInNs(0.0)
64 , fdTsCoreSizeInNs(0.0)
65 , fuMinNbGdpb(0)
66 , fuCurrNbGdpb(0)
67 , fUnpackPar()
68 , fuNrOfGdpbs(0)
69 , fuNrOfFeePerGdpb(0)
70 , fuNrOfGet4PerFee(0)
71 , fuNrOfChannelsPerGet4(0)
72 , fuNrOfChannelsPerFee(0)
73 , fuNrOfGet4(0)
74 , fuNrOfGet4PerGdpb(0)
75 , fuNrOfChannelsPerGdpb(0)
76 , fuRawDataPrintMsgNb(100000)
77 , fuRawDataPrintMsgIdx(fuRawDataPrintMsgNb)
78 , fbPrintAllHitsEnable(kFALSE)
79 , fbPrintAllEpochsEnable(kFALSE)
80 , fbPulserModeEnable(kFALSE)
81 , fbCoincMapsEnable(kFALSE)
82 , fulCurrentTsIndex(0)
83 , fuCurrentMs(0)
84 , fdMsIndex(0)
85 , fuGdpbId(0)
86 , fuGdpbNr(0)
87 , fuGet4Id(0)
88 , fuGet4Nr(0)
89 , fiEquipmentId(0)
90 , fviMsgCounter(11, 0)
91 , // length of enum MessageTypes initialized with 0
92 fvulGdpbTsMsb()
93 , fvulGdpbTsLsb()
94 , fvulStarTsMsb()
95 , fvulStarTsMid()
96 , fvulGdpbTsFullLast()
97 , fvulStarTsFullLast()
98 , fvuStarTokenLast()
99 , fvuStarDaqCmdLast()
100 , fvuStarTrigCmdLast()
101 , fvulCurrentEpoch()
102 , fvbFirstEpochSeen()
103 , fvulCurrentEpochCycle()
104 , fvulCurrentEpochFull()
105 , fulCurrentEpochTime(0)
106 , fGdpbIdIndexMap()
107 , fvmEpSupprBuffer()
108 , fvuFeeNbHitsLastMs()
109 , fdTsLastPulserHit()
110 , fvuCoincNbHitsLastMs()
111 , fvdCoincTsLastHit()
112 , dMinDt(-1. * (kuNbBinsDt * gdpbv100::kdBinSize / 2.) - gdpbv100::kdBinSize / 2.)
113 , dMaxDt(1. * (kuNbBinsDt * gdpbv100::kdBinSize / 2.) + gdpbv100::kdBinSize / 2.)
114 , fuNbFeePlot(2)
115 , fuNbFeePlotsPerGdpb(0)
116 , fdStartTime(-1.)
117 , fdStartTimeLong(-1.)
118 , fdStartTimeMsSz(-1.)
119 , fuHistoryHistoSize(1800)
120 , fuHistoryHistoSizeLong(600)
121 , fdLastRmsUpdateTime(0.0)
122 , fdFitZoomWidthPs(0.0)
123 , fcMsSizeAll(NULL)
124 , fvhMsSzPerLink(12, NULL)
125 , fvhMsSzTimePerLink(12, NULL)
126 , fhMessType(NULL)
127 , fhSysMessType(NULL)
128 , fhGet4MessType(NULL)
129 , fhGet4ChanScm(NULL)
130 , fhGet4ChanErrors(NULL)
131 , fhGet4EpochFlags(NULL)
132 , fhGdpbMessType(NULL)
133 , fhGdpbSysMessType(NULL)
134 , fhGdpbSysMessPattType(NULL)
135 , fhGdpbEpochFlags(NULL)
136 , fhGdpbEpochSyncEvo(NULL)
137 , fhGdpbEpochMissEvo(NULL)
138 , fvhGdpbGet4MessType()
139 , fvhGdpbGet4ChanScm()
140 , fvhGdpbGet4ChanErrors()
141 , fhScmScalerCounters(NULL)
142 , fhScmDeadtimeCounters(NULL)
143 , fhScmSeuCounters(NULL)
144 , fhScmSeuCountersEvo(NULL)
145 , fhPatternMissmatch(NULL)
146 , fhPatternEnable(NULL)
147 , fhPatternResync(NULL)
148 , fvhGdpbPatternMissmatchEvo()
149 , fvhGdpbPatternEnableEvo()
150 , fvhGdpbPatternResyncEvo()
151 , fvhRawFt_gDPB()
152 , fvhRawTot_gDPB()
153 , fvhChCount_gDPB()
154 , fvhChannelRate_gDPB()
155 , fvhRemapTot_gDPB()
156 , fvhRemapChCount_gDPB()
157 , fvhRemapChRate_gDPB()
158 , fvhFeeRate_gDPB()
159 , fvhFeeErrorRate_gDPB()
160 , fvhFeeErrorRatio_gDPB()
161 , fvhFeeRateLong_gDPB()
162 , fvhFeeErrorRateLong_gDPB()
163 , fvhFeeErrorRatioLong_gDPB()
164 , fvhRemapTotSideA_mod()
165 , fvhRemapTotSideB_mod()
166 , fvhModRate()
167 , fvhModErrorRate()
168 , fvhModErrorRatio()
169 , fvhTokenMsgType()
170 , fvhTriggerRate()
171 , fvhCmdDaqVsTrig()
172 , fvhStarTokenEvo()
173 , fvhStarTrigGdpbTsEvo()
174 , fvhStarTrigStarTsEvo()
175 , fvhTimeDiffPulser()
176 , fhTimeMeanPulser(NULL)
177 , fhTimeRmsPulser(NULL)
178 , fhTimeRmsZoomFitPuls(NULL)
179 , fhTimeResFitPuls(NULL)
180 , fvhPulserTimeDiffEvoGbtxGbtx()
181 , fvvhPulserTimeDiffEvoGdpbGdpb()
182 , fvuPadiToGet4()
183 , fvuGet4ToPadi()
184 , fvuElinkToGet4()
185 , fvuGet4ToElink()
186 , fTimeLastHistoSaving()
187{
188}
189
191
193{
194 LOG(info) << "Initializing Get4 monitor";
195
196 FairRootManager* ioman = FairRootManager::Instance();
197 if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; } // if( ioman == NULL )
198
199 return kTRUE;
200}
201
203{
204 LOG(info) << "Setting parameter containers for " << GetName();
205 fUnpackPar = (CbmStar2019TofPar*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmStar2019TofPar"));
206}
207
209{
210 LOG(info) << "Init parameter containers for " << GetName();
211 Bool_t initOK = ReInitContainers();
212
214
219 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
220 for (UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j) {
224 } // for( UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j )
225 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
226
227 return initOK;
228}
229
231{
232 LOG(info) << "ReInit parameter containers for " << GetName();
233
235 LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
237
238 fuNrOfFeePerGdpb = fUnpackPar->GetNrOfFeesPerGdpb();
239 LOG(info) << "Nr. of FEEs per Tof GDPB: " << fuNrOfFeePerGdpb;
240
242 LOG(info) << "Nr. of GET4 per Tof FEE: " << fuNrOfGet4PerFee;
243
245 LOG(info) << "Nr. of channels per GET4: " << fuNrOfChannelsPerGet4;
246
248 LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
249
251 LOG(info) << "Nr. of GET4s: " << fuNrOfGet4;
252
254 LOG(info) << "Nr. of GET4s per GDPB: " << fuNrOfGet4PerGdpb;
255
257 LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
258
259 fGdpbIdIndexMap.clear();
260 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
262 LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex << fUnpackPar->GetGdpbId(i) << std::dec;
263 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
264
266 LOG(info) << "Nr. of GBTx: " << fuNrOfGbtx;
267
269 LOG(info) << "Nr. of GBTx: " << fuNrOfModules;
270
271 fviRpcType.resize(fuNrOfGbtx);
272 fviModuleId.resize(fuNrOfGbtx);
273 fviNrOfRpc.resize(fuNrOfGbtx);
274 fviRpcSide.resize(fuNrOfGbtx);
275 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx) {
276 fviNrOfRpc[uGbtx] = fUnpackPar->GetNrOfRpc(uGbtx);
277 fviRpcType[uGbtx] = fUnpackPar->GetRpcType(uGbtx);
278 fviRpcSide[uGbtx] = fUnpackPar->GetRpcSide(uGbtx);
279 fviModuleId[uGbtx] = fUnpackPar->GetModuleId(uGbtx);
280 } // for( UInt_t uGbtx = 0; uGbtx < uNrOfGbtx; ++uGbtx)
281
282 LOG(info) << "Nr. of RPCs per GBTx: ";
283 std::stringstream ss;
284 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
285 ss << Form(" %2d", fviNrOfRpc[uGbtx]);
286 LOG(info) << ss.str();
287
288 LOG(info) << "RPC type per GBTx: ";
289 std::stringstream ss;
290 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
291 ss << Form(" %2d", fviRpcType[uGbtx]);
292 LOG(info) << ss.str();
293
294 LOG(info) << "RPC side per GBTx: ";
295 std::stringstream ss;
296 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
297 ss << Form(" %2d", fviRpcSide[uGbtx]);
298 LOG(info) << ss.str();
299
300 LOG(info) << "Module ID per GBTx: ";
301 std::stringstream ss;
302 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
303 ss << Form(" %2d", fviModuleId[uGbtx]);
304 LOG(info) << ss.str();
305
306 fuTotalMsNb = fUnpackPar->GetNbMsTot();
307 fuOverlapMsNb = fUnpackPar->GetNbMsOverlap();
311 LOG(info) << "Timeslice parameters: " << fuTotalMsNb << " MS per link, of which " << fuOverlapMsNb
312 << " overlap MS, each MS is " << fdMsSizeInNs << " ns";
313
324 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
325 fvulGdpbTsMsb[uGdpb] = 0;
326 fvulGdpbTsLsb[uGdpb] = 0;
327 fvulStarTsMsb[uGdpb] = 0;
328 fvulStarTsMid[uGdpb] = 0;
329 fvulGdpbTsFullLast[uGdpb] = 0;
330 fvulStarTsFullLast[uGdpb] = 0;
331 fvuStarTokenLast[uGdpb] = 0;
332 fvuStarDaqCmdLast[uGdpb] = 0;
333 fvuStarTrigCmdLast[uGdpb] = 0;
334 } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
335
337
339 if (kTRUE == fbPulserModeEnable) {
342 } // if( kTRUE == fbPulserModeEnable )
343
345 if (kTRUE == fbCoincMapsEnable) {
348 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
350 fvdCoincTsLastHit[uGdpb].resize(fuNrOfChannelsPerGdpb, 0.0);
351 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
352 } // if( kTRUE == fbCoincMapsEnable )
353
357 /*
358 UInt_t uGet4topadi[32] = {
359 4, 3, 2, 1, // provided by Jochen
360 24, 23, 22, 21,
361 8, 7, 6, 5,
362 28, 27, 26, 25,
363 12, 11, 10, 9,
364 32, 31, 30, 29,
365 16, 15, 14, 13,
366 20, 19, 18, 17 };
367*/
369 UInt_t uGet4topadi[32] = {4, 3, 2, 1, // provided by Jochen
370 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19,
371 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29};
372
373 UInt_t uPaditoget4[32] = {4, 3, 2, 1, // provided by Jochen
374 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, 26, 25, 32, 31,
375 30, 29, 8, 7, 6, 5, 16, 15, 14, 13, 24, 23, 22, 21};
376
377 for (UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan) {
378 fvuPadiToGet4[uChan] = uPaditoget4[uChan] - 1;
379 fvuGet4ToPadi[uChan] = uGet4topadi[uChan] - 1;
380 } // for( UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan )
381
382
386 UInt_t kuElinkToGet4[kuNbGet4PerGbtx] = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
387 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
388 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
389 UInt_t kuGet4ToElink[kuNbGet4PerGbtx] = {24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
390 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
391 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
392
393 for (UInt_t uLinkAsic = 0; uLinkAsic < kuNbGet4PerGbtx; ++uLinkAsic) {
394 fvuElinkToGet4[uLinkAsic] = kuElinkToGet4[uLinkAsic];
395 fvuGet4ToElink[uLinkAsic] = kuGet4ToElink[uLinkAsic];
396 } // for( UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan )
397
398 return kTRUE;
399}
400
401
402void CbmStar2019MonitorTof::AddMsComponentToList(size_t component, UShort_t usDetectorId)
403{
405 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
406 if (component == fvMsComponentsList[uCompIdx]) return;
407
409 fvMsComponentsList.push_back(component);
410
412 if (NULL == fvhMsSzPerLink[component]) {
413 TString sMsSzName = Form("MsSz_link_%02lu", component);
414 TString sMsSzTitle = Form("Size of MS from link %02lu; Ms Size [bytes]", component);
415 fvhMsSzPerLink[component] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
416
417 sMsSzName = Form("MsSzTime_link_%02lu", component);
418 sMsSzTitle = Form("Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
419 fvhMsSzTimePerLink[component] =
420 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 100 * fuHistoryHistoSize, 0., 2 * fuHistoryHistoSize);
421 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
422 if (server) {
423 server->Register("/FlibRaw", fvhMsSzPerLink[component]);
424 server->Register("/FlibRaw", fvhMsSzTimePerLink[component]);
425 } // if( server )
426 if (NULL != fcMsSizeAll) {
427 fcMsSizeAll->cd(1 + component);
428 gPad->SetLogy();
429 fvhMsSzTimePerLink[component]->Draw("hist le0");
430 } // if( NULL != fcMsSizeAll )
431 LOG(info) << "Added MS size histo for component (link): " << component;
432 } // if( NULL == fvhMsSzPerLink[ component ] )
433}
434void CbmStar2019MonitorTof::SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
435{
436 fuNbCoreMsPerTs = uCoreMsNb;
437 fuNbOverMsPerTs = uOverlapMsNb;
438
439 // UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
440}
441
443{
444 LOG(info) << "create Histos for " << fuNrOfGdpbs << " gDPBs ";
445
446 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
447
448 TString name {""};
449 TString title {""};
450
451 // Full Fee time difference test
452 UInt_t uNbBinsDt = kuNbBinsDt + 1; // To account for extra bin due to shift by 1/2 bin of both ranges
453
455 Double_t dBinSzG4v2 = (6250. / 112.);
456 dMinDt = -1. * (kuNbBinsDt * dBinSzG4v2 / 2.) - dBinSzG4v2 / 2.;
457 dMaxDt = 1. * (kuNbBinsDt * dBinSzG4v2 / 2.) + dBinSzG4v2 / 2.;
458
459 /*******************************************************************/
460 name = "hMessageType";
461 title = "Nb of message for each type; Type";
462 // Test Big Data readout with plotting
463 fhMessType = new TH1I(name, title, 1 + gdpbv100::MSG_STAR_TRI_D, 0., 1 + gdpbv100::MSG_STAR_TRI_D);
464 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_HIT, "HIT");
465 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_EPOCH, "EPOCH");
466 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SLOWC, "SLOWC");
467 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SYST, "SYST");
468 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_A, "TRI_A");
469 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_B, "TRI_B");
470 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_C, "TRI_C");
471 fhMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_D, "TRI_D");
472
473 /*******************************************************************/
474 name = "hSysMessType";
475 title = "Nb of system message for each type; System Type";
476 fhSysMessType = new TH1I(name, title, 1 + gdpbv100::SYS_PATTERN, 0., 1 + gdpbv100::SYS_PATTERN);
477 fhSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GET4_ERROR, "GET4 ERROR");
478 fhSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GDPB_UNKWN, "UNKW GET4 MSG");
479 fhSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GET4_SYNC_MISS, "SYS_GET4_SYNC_MISS");
480 fhSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_PATTERN, "SYS_PATTERN");
481
482 /*******************************************************************/
483 name = "hGet4MessType";
484 title = "Nb of message for each type per GET4; GET4 chip # ; Type";
485 fhGet4MessType = new TH2I(name, title, fuNrOfGet4, 0., fuNrOfGet4, 4, 0., 4.);
486 fhGet4MessType->GetYaxis()->SetBinLabel(1, "DATA 32b");
487 fhGet4MessType->GetYaxis()->SetBinLabel(2, "EPOCH");
488 fhGet4MessType->GetYaxis()->SetBinLabel(3, "S.C. M");
489 fhGet4MessType->GetYaxis()->SetBinLabel(4, "ERROR");
490 // fhGet4MessType->GetYaxis()->SetBinLabel( 5, "DATA 24b");
491 // fhGet4MessType->GetYaxis()->SetBinLabel( 6, "STAR Trigger");
492
493 /*******************************************************************/
494 name = "hGet4ChanScm";
495 title = "SC messages per GET4 channel; GET4 channel # ; SC type";
497 new TH2I(name, title, 2 * fuNrOfGet4 * fuNrOfChannelsPerGet4, 0., fuNrOfGet4 * fuNrOfChannelsPerGet4, 5, 0., 5.);
498 fhGet4ChanScm->GetYaxis()->SetBinLabel(1, "Hit Scal");
499 fhGet4ChanScm->GetYaxis()->SetBinLabel(2, "Deadtime");
500 fhGet4ChanScm->GetYaxis()->SetBinLabel(3, "SPI");
501 fhGet4ChanScm->GetYaxis()->SetBinLabel(4, "SEU Scal");
502 fhGet4ChanScm->GetYaxis()->SetBinLabel(5, "START");
503
504 /*******************************************************************/
505 name = "hGet4ChanErrors";
506 title = "Error messages per GET4 channel; GET4 channel # ; Error";
508 new TH2I(name, title, fuNrOfGet4 * fuNrOfChannelsPerGet4, 0., fuNrOfGet4 * fuNrOfChannelsPerGet4, 21, 0., 21.);
509 fhGet4ChanErrors->GetYaxis()->SetBinLabel(1, "0x00: Readout Init ");
510 fhGet4ChanErrors->GetYaxis()->SetBinLabel(2, "0x01: Sync ");
511 fhGet4ChanErrors->GetYaxis()->SetBinLabel(3, "0x02: Epoch count sync");
512 fhGet4ChanErrors->GetYaxis()->SetBinLabel(4, "0x03: Epoch ");
513 fhGet4ChanErrors->GetYaxis()->SetBinLabel(5, "0x04: FIFO Write ");
514 fhGet4ChanErrors->GetYaxis()->SetBinLabel(6, "0x05: Lost event ");
515 fhGet4ChanErrors->GetYaxis()->SetBinLabel(7, "0x06: Channel state ");
516 fhGet4ChanErrors->GetYaxis()->SetBinLabel(8, "0x07: Token Ring state");
517 fhGet4ChanErrors->GetYaxis()->SetBinLabel(9, "0x08: Token ");
518 fhGet4ChanErrors->GetYaxis()->SetBinLabel(10, "0x09: Error Readout ");
519 fhGet4ChanErrors->GetYaxis()->SetBinLabel(11, "0x0a: SPI ");
520 fhGet4ChanErrors->GetYaxis()->SetBinLabel(12, "0x0b: DLL Lock error "); // <- From GET4 v1.2
521 fhGet4ChanErrors->GetYaxis()->SetBinLabel(13, "0x0c: DLL Reset invoc."); // <- From GET4 v1.2
522 fhGet4ChanErrors->GetYaxis()->SetBinLabel(14, "0x11: Overwrite ");
523 fhGet4ChanErrors->GetYaxis()->SetBinLabel(15, "0x12: ToT out of range");
524 fhGet4ChanErrors->GetYaxis()->SetBinLabel(16, "0x13: Event Discarded ");
525 fhGet4ChanErrors->GetYaxis()->SetBinLabel(17, "0x14: Add. Rising edge"); // <- From GET4 v1.3
526 fhGet4ChanErrors->GetYaxis()->SetBinLabel(18, "0x15: Unpaired Falling"); // <- From GET4 v1.3
527 fhGet4ChanErrors->GetYaxis()->SetBinLabel(19, "0x16: Sequence error "); // <- From GET4 v1.3
528 fhGet4ChanErrors->GetYaxis()->SetBinLabel(20, "0x7f: Unknown ");
529 fhGet4ChanErrors->GetYaxis()->SetBinLabel(21, "Corrupt/unsuprtd error");
530
531 /*******************************************************************/
532 name = "hGet4EpochFlags";
533 title = "Epoch flags per GET4; GET4 chip # ; Type";
534 fhGet4EpochFlags = new TH2I(name, title, fuNrOfGet4, 0., fuNrOfGet4, 4, 0., 4.);
535 fhGet4EpochFlags->GetYaxis()->SetBinLabel(1, "SYNC");
536 fhGet4EpochFlags->GetYaxis()->SetBinLabel(2, "Ep LOSS");
537 fhGet4EpochFlags->GetYaxis()->SetBinLabel(3, "Da LOSS");
538 fhGet4EpochFlags->GetYaxis()->SetBinLabel(4, "MISSMAT");
539
540 /*******************************************************************/
541 name = "hGdpbMessageType";
542 title = "Nb of message for each type per Gdpb; Type; Gdpb Idx []";
543 // Test Big Data readout with plotting
545 -0.5, fuNrOfGdpbs - 0.5);
546 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_HIT, "HIT");
547 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_EPOCH, "EPOCH");
548 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SLOWC, "SLOWC");
549 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SYST, "SYST");
550 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_A, "TRI_A");
551 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_B, "TRI_B");
552 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_C, "TRI_C");
553 fhGdpbMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_D, "TRI_D");
554
555 /*******************************************************************/
556 name = "hGdpbSysMessType";
557 title = "Nb of system message for each type per Gdpb; System Type; Gdpb Idx []";
558 fhGdpbSysMessType = new TH2I(name, title, 1 + gdpbv100::SYS_PATTERN, 0., 1 + gdpbv100::SYS_PATTERN, fuNrOfGdpbs, -0.5,
559 fuNrOfGdpbs - 0.5);
560 fhGdpbSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GET4_ERROR, "GET4 ERROR");
561 fhGdpbSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GDPB_UNKWN, "UNKW GET4 MSG");
562 fhGdpbSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_GET4_SYNC_MISS, "SYS_GET4_SYNC_MISS");
563 fhGdpbSysMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::SYS_PATTERN, "SYS_PATTERN");
564
565 /*******************************************************************/
566 name = "hGdpbSysMessPattType";
567 title = "Nb of pattern message for each type per Gdpb; Pattern Type; Gdpb Idx []";
569 -0.5, fuNrOfGdpbs - 0.5);
570 fhGdpbSysMessPattType->GetXaxis()->SetBinLabel(1 + gdpbv100::PATT_MISSMATCH, "PATT_MISSMATCH");
571 fhGdpbSysMessPattType->GetXaxis()->SetBinLabel(1 + gdpbv100::PATT_ENABLE, "PATT_ENABLE");
572 fhGdpbSysMessPattType->GetXaxis()->SetBinLabel(1 + gdpbv100::PATT_RESYNC, "PATT_RESYNC");
573
574 /*******************************************************************/
575 name = "hGdpbEpochFlags";
576 title = "Epoch flags per gDPB; gDPB # ; Type";
577 fhGdpbEpochFlags = new TH2I(name, title, fuNrOfGdpbs, 0., fuNrOfGdpbs, 4, 0., 4.);
578 fhGdpbEpochFlags->GetYaxis()->SetBinLabel(1, "SYNC");
579 fhGdpbEpochFlags->GetYaxis()->SetBinLabel(2, "Ep LOSS");
580 fhGdpbEpochFlags->GetYaxis()->SetBinLabel(3, "Da LOSS");
581 fhGdpbEpochFlags->GetYaxis()->SetBinLabel(4, "MISSMAT");
582
583 /*******************************************************************/
584 name = Form("hGdpbEpochSyncEvo");
585 title = Form("Epoch SYNC per second and gDPB; Time[s]; gDPB #; SYNC Nb");
587 new TH2D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize, fuNrOfGdpbs, 0., fuNrOfGdpbs);
588
589 /*******************************************************************/
590 name = Form("hGdpbEpochMissEvo");
591 title = Form("Epoch Missmatch per second and gDPB; Time[s]; gDPB #; Missmatch Nb");
593 new TH2D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize, fuNrOfGdpbs, 0., fuNrOfGdpbs);
594
595 /*******************************************************************/
596 // Slow control messages analysis
597 name = "hScmScalerCounters";
598 title = "Content of Scaler counter SC messages; Scaler counter [hit]; Channel []";
599 fhScmScalerCounters = new TH2I(name, title, fuNrOfGet4 * fuNrOfChannelsPerGet4 * 2, 0.,
600 fuNrOfGet4 * fuNrOfChannelsPerGet4, 8192, 0., 8192.);
601
602 name = "hScmDeadtimeCounters";
603 title = "Content of Deadtime counter SC messages; Deadtime [Clk Cycles]; "
604 "Channel []";
605 fhScmDeadtimeCounters = new TH2I(name, title, fuNrOfGet4 * fuNrOfChannelsPerGet4 * 2, 0.,
606 fuNrOfGet4 * fuNrOfChannelsPerGet4, 8192, 0., 8192.);
607
608 name = "hScmSeuCounters";
609 title = "Content of SEU counter SC messages; SEU []; Channel []";
610 fhScmSeuCounters = new TH2I(name, title, fuNrOfGet4 * fuNrOfChannelsPerGet4 * 2, 0.,
611 fuNrOfGet4 * fuNrOfChannelsPerGet4, 8192, 0., 8192.);
612
613 name = "hScmSeuCountersEvo";
614 title = "SEU counter rate from SC messages; Time in Run [s]; Channel []; SEU []";
615 fhScmSeuCountersEvo = new TH2I(name, title, fuNrOfGet4 * fuNrOfChannelsPerGet4 * 2, 0.,
617
618 /*******************************************************************/
619 name = "hPatternMissmatch";
620 title = "Missmatch pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
622 new TH2I(name, title, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb, fuNrOfGdpbs, -0.5, fuNrOfGdpbs - 0.5);
623 name = "hPatternEnable";
624 title = "Enable pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
626 new TH2I(name, title, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb, fuNrOfGdpbs, -0.5, fuNrOfGdpbs - 0.5);
627 name = "hPatternResync";
628 title = "Resync pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
630 new TH2I(name, title, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb, fuNrOfGdpbs, -0.5, fuNrOfGdpbs - 0.5);
631
632
633 /*******************************************************************/
634 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
635
636 /*******************************************************************/
637 name = Form("hGdpbGet4MessType_%02u", uGdpb);
638 title = Form("Nb of message for each type per GET4 in gDPB %02u; GET4 chip # ; Type", uGdpb);
639 fvhGdpbGet4MessType.push_back(new TH2I(name, title, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb, 4, 0., 4.));
640 fvhGdpbGet4MessType[uGdpb]->GetYaxis()->SetBinLabel(1, "DATA 32b");
641 fvhGdpbGet4MessType[uGdpb]->GetYaxis()->SetBinLabel(2, "EPOCH");
642 fvhGdpbGet4MessType[uGdpb]->GetYaxis()->SetBinLabel(3, "S.C. M");
643 fvhGdpbGet4MessType[uGdpb]->GetYaxis()->SetBinLabel(4, "ERROR");
644
645 /*******************************************************************/
646 name = Form("hGdpbGet4ChanScm_%02u", uGdpb);
647 title = Form("SC messages per GET4 channel in gDPB %02u; GET4 channel # ; SC type", uGdpb);
648 fvhGdpbGet4ChanScm.push_back(
649 new TH2I(name, title, 2 * fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, 5, 0., 5.));
650 fvhGdpbGet4ChanScm[uGdpb]->GetYaxis()->SetBinLabel(1, "Hit Scal");
651 fvhGdpbGet4ChanScm[uGdpb]->GetYaxis()->SetBinLabel(2, "Deadtime");
652 fvhGdpbGet4ChanScm[uGdpb]->GetYaxis()->SetBinLabel(3, "SPI");
653 fvhGdpbGet4ChanScm[uGdpb]->GetYaxis()->SetBinLabel(4, "SEU Scal");
654 fvhGdpbGet4ChanScm[uGdpb]->GetYaxis()->SetBinLabel(5, "START");
655
656 /*******************************************************************/
657 name = Form("hGdpbGet4ChanErrors_%02u", uGdpb);
658 title = Form("Error messages per GET4 channel in gDPB %02u; GET4 channel # ; Error", uGdpb);
659 fvhGdpbGet4ChanErrors.push_back(
660 new TH2I(name, title, fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, 22, 0., 22.));
661 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(1, "0x00: Readout Init ");
662 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(2, "0x01: Sync ");
663 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(3, "0x02: Epoch count sync");
664 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(4, "0x03: Epoch ");
665 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(5, "0x04: FIFO Write ");
666 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(6, "0x05: Lost event ");
667 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(7, "0x06: Channel state ");
668 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(8, "0x07: Token Ring state");
669 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(9, "0x08: Token ");
670 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(10, "0x09: Error Readout ");
671 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(11, "0x0a: SPI ");
672 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(12, "0x0b: DLL Lock error "); // <- From GET4 v1.2
673 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(13, "0x0c: DLL Reset invoc."); // <- From GET4 v1.2
674 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(14, "0x11: Overwrite "); // <- From GET4 v1.0 to 1.3
675 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(15, "0x12: ToT out of range");
676 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(16, "0x13: Event Discarded ");
677 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(17, "0x14: Add. Rising edge"); // <- From GET4 v1.3
678 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(18, "0x15: Unpaired Falling"); // <- From GET4 v1.3
679 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(19, "0x16: Sequence error "); // <- From GET4 v1.3
680 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(20, "0x17: Epoch Overflow "); // <- From GET4 v2.0
681 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(21, "0x7f: Unknown ");
682 fvhGdpbGet4ChanErrors[uGdpb]->GetYaxis()->SetBinLabel(22, "Corrupt/unsuprtd error");
683
684 /*******************************************************************/
685 name = Form("hGdpbPatternMissmatchEvo_%02u", uGdpb);
686 title = Form("Missmatch pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
688 new TH2I(name, title, 10000, 0., 100000, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb));
689
690 name = Form("hGdpbPatternEnableEvo_%02u", uGdpb);
691 title = Form("Enable pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
692 fvhGdpbPatternEnableEvo.push_back(
693 new TH2I(name, title, 10000, 0., 100000, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb));
694
695 name = Form("hGdpbPatternResyncEvo%02u", uGdpb);
696 title = Form("Resync pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
697 fvhGdpbPatternResyncEvo.push_back(
698 new TH2I(name, title, 10000, 0., 100000, fuNrOfGet4PerGdpb, 0., fuNrOfGet4PerGdpb));
699
701 name = Form("RawFt_gDPB_%02u", uGdpb);
702 title = Form("Raw FineTime gDPB %02u Plot 0; channel; FineTime [bin]", uGdpb);
703 fvhRawFt_gDPB.push_back(
704 new TH2F(name.Data(), title.Data(), fuNrOfChannelsPerGdpb, 0, fuNrOfChannelsPerGdpb, 128, 0, 128));
705
707 name = Form("RawTot_gDPB_%02u", uGdpb);
708 title = Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb);
709 fvhRawTot_gDPB.push_back(
710 new TH2F(name.Data(), title.Data(), fuNrOfChannelsPerGdpb, 0, fuNrOfChannelsPerGdpb, 256, 0, 256));
711
713 name = Form("ChCount_gDPB_%02u", uGdpb);
714 title = Form("Channel counts gDPB %02u; channel; Hits", uGdpb);
715 fvhChCount_gDPB.push_back(new TH1I(name.Data(), title.Data(), fuNrOfFeePerGdpb * fuNrOfChannelsPerFee, 0,
717
719 name = Form("ChRate_gDPB_%02u", uGdpb);
720 title = Form("Channel rate gDPB %02u; Time in run [s]; channel; Rate [1/s]", uGdpb);
721 fvhChannelRate_gDPB.push_back(new TH2D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize,
724
726 name = Form("RemapTot_gDPB_%02u", uGdpb);
727 title = Form("Raw TOT gDPB %02u remapped; PADI channel; TOT [bin]", uGdpb);
728 fvhRemapTot_gDPB.push_back(
729 new TH2F(name.Data(), title.Data(), fuNrOfChannelsPerGdpb, 0, fuNrOfChannelsPerGdpb, 256, 0, 256));
730
732 name = Form("RemapChCount_gDPB_%02u", uGdpb);
733 title = Form("Channel counts gDPB %02u remapped; PADI channel; Hits", uGdpb);
734 fvhRemapChCount_gDPB.push_back(new TH1I(name.Data(), title.Data(), fuNrOfFeePerGdpb * fuNrOfChannelsPerFee, 0,
736
738 name = Form("RemapChRate_gDPB_%02u", uGdpb);
739 title = Form("PADI channel rate gDPB %02u; Time in run [s]; PADI channel; Rate [1/s]", uGdpb);
740 fvhRemapChRate_gDPB.push_back(new TH2D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize,
743
745 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
746 name = Form("FeeRate_gDPB_g%02u_f%1u", uGdpb, uFee);
747 title = Form("Counts per second in Fee %1u of gDPB %02u; Time[s] ; Counts", uFee, uGdpb);
748 fvhFeeRate_gDPB.push_back(new TH1D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
749
750 name = Form("FeeErrorRate_gDPB_g%02u_f%1u", uGdpb, uFee);
751 title = Form("Error Counts per second in Fee %1u of gDPB %02u; Time[s] ; "
752 "Error Counts",
753 uFee, uGdpb);
754 fvhFeeErrorRate_gDPB.push_back(new TH1D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
755
756 name = Form("FeeErrorRatio_gDPB_g%02u_f%1u", uGdpb, uFee);
757 title = Form("Error to data ratio per second in Fee %1u of gDPB %02u; "
758 "Time[s] ; Error ratio[]",
759 uFee, uGdpb);
760 fvhFeeErrorRatio_gDPB.push_back(
761 new TProfile(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
762
763 name = Form("FeeRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
764 title = Form("Counts per minutes in Fee %1u of gDPB %02u; Time[min] ; Counts", uFee, uGdpb);
765 fvhFeeRateLong_gDPB.push_back(
766 new TH1D(name.Data(), title.Data(), fuHistoryHistoSizeLong, 0, fuHistoryHistoSizeLong));
767
768 name = Form("FeeErrorRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
769 title = Form("Error Counts per minutes in Fee %1u of gDPB %02u; "
770 "Time[min] ; Error Counts",
771 uFee, uGdpb);
772 fvhFeeErrorRateLong_gDPB.push_back(
773 new TH1D(name.Data(), title.Data(), fuHistoryHistoSizeLong, 0, fuHistoryHistoSizeLong));
774
775 name = Form("FeeErrorRatioLong_gDPB_g%02u_f%1u", uGdpb, uFee);
776 title = Form("Error to data ratio per minutes in Fee %1u of gDPB %02u; "
777 "Time[min] ; Error ratio[]",
778 uFee, uGdpb);
780 new TProfile(name.Data(), title.Data(), fuHistoryHistoSizeLong, 0, fuHistoryHistoSizeLong));
781 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; uFee++)
782
785 name = Form("hTokenMsgType_gDPB_%02u", uGdpb);
786 title = Form("STAR trigger Messages type gDPB %02u; Type ; Counts", uGdpb);
787 fvhTokenMsgType.push_back(new TH1F(name, title, 4, 0, 4));
788 fvhTokenMsgType[uGdpb]->GetXaxis()->SetBinLabel(1, "A"); // gDPB TS high
789 fvhTokenMsgType[uGdpb]->GetXaxis()->SetBinLabel(2, "B"); // gDPB TS low, STAR TS high
790 fvhTokenMsgType[uGdpb]->GetXaxis()->SetBinLabel(3, "C"); // STAR TS mid
791 fvhTokenMsgType[uGdpb]->GetXaxis()->SetBinLabel(4, "D"); // STAR TS low, token, CMDs
792 if (server) server->Register("/StarRaw", fvhTokenMsgType[uGdpb]);
793
794 name = Form("hTriggerRate_gDPB_%02u", uGdpb);
795 title = Form("STAR trigger signals per second gDPB %02u; Time[s] ; Counts", uGdpb);
796 fvhTriggerRate.push_back(new TH1F(name, title, fuHistoryHistoSize, 0, fuHistoryHistoSize));
797 if (server) server->Register("/StarRaw", fvhTriggerRate[uGdpb]);
798
799 name = Form("hCmdDaqVsTrig_gDPB_%02u", uGdpb);
800 title = Form("STAR daq command VS STAR trigger command gDPB %02u; DAQ ; TRIGGER", uGdpb);
801 fvhCmdDaqVsTrig.push_back(new TH2I(name, title, 16, 0, 16, 16, 0, 16));
802 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(1, "0x0: no-trig "); // idle link
803 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(
804 2, "0x1: clear "); // clears redundancy counters on the readout boards
805 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(3, "0x2: mast-rst"); // general reset of the whole front-end logic
806 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(4, "0x3: spare "); // reserved
807 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(
808 5, "0x4: trigg. 0"); // Default physics readout, all det support required
809 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(6, "0x5: trigg. 1"); //
810 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(7, "0x6: trigg. 2"); //
811 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(8, "0x7: trigg. 3"); //
812 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(9, "0x8: puls. 0"); //
813 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(10, "0x9: puls. 1"); //
814 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(11, "0xA: puls. 2"); //
815 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(12, "0xB: puls. 3"); //
816 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(
817 13,
818 "0xC: config "); // housekeeping trigger: return geographic info of FE
819 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(14, "0xD: abort "); // aborts and clears an active event
820 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(15, "0xE: L1accept"); //
821 fvhCmdDaqVsTrig[uGdpb]->GetXaxis()->SetBinLabel(16, "0xF: L2accept"); //
822 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(1, "0x0: 0"); // To be filled at STAR
823 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(2, "0x1: 1"); // To be filled at STAR
824 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(3, "0x2: 2"); // To be filled at STAR
825 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(4, "0x3: 3"); // To be filled at STAR
826 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(5, "0x4: 4"); // To be filled at STAR
827 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(6, "0x5: 5"); // To be filled at STAR
828 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(7, "0x6: 6"); // To be filled at STAR
829 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(8, "0x7: 7"); // To be filled at STAR
830 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(9, "0x8: 8"); // To be filled at STAR
831 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(10, "0x9: 9"); // To be filled at STAR
832 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(11, "0xA: 10"); // To be filled at STAR
833 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(12, "0xB: 11"); // To be filled at STAR
834 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(13, "0xC: 12"); // To be filled at STAR
835 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(14, "0xD: 13"); // To be filled at STAR
836 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(15, "0xE: 14"); // To be filled at STAR
837 fvhCmdDaqVsTrig[uGdpb]->GetYaxis()->SetBinLabel(16, "0xF: 15"); // To be filled at STAR
838 if (server) server->Register("/StarRaw", fvhCmdDaqVsTrig[uGdpb]);
839
840 name = Form("hStarTokenEvo_gDPB_%02u", uGdpb);
841 title = Form("STAR token value VS time gDPB %02u; Time in Run [s] ; STAR "
842 "Token; Counts",
843 uGdpb);
844 fvhStarTokenEvo.push_back(new TH2I(name, title, fuHistoryHistoSize, 0, fuHistoryHistoSize, 410, 0, 4100));
845
846
847 name = Form("hStarTrigGdpbTsEvo_gDPB_%02u", uGdpb);
848 title = Form("gDPB TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; gDPB TS;", uGdpb);
849 fvhStarTrigGdpbTsEvo.push_back(new TProfile(name, title, fuHistoryHistoSize, 0, fuHistoryHistoSize));
850
851 name = Form("hStarTrigStarTsEvo_gDPB_%02u", uGdpb);
852 title = Form("STAR TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; STAR TS;", uGdpb);
853 fvhStarTrigStarTsEvo.push_back(new TProfile(name, title, fuHistoryHistoSize, 0, fuHistoryHistoSize));
854 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
855
856 /*******************************************************************/
858 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
859 name = Form("RemapTotSideA_mod_%02u", uMod);
860 title = Form("Raw TOT module %02u Side A; PADI channel; TOT [bin]", uMod);
861 fvhRemapTotSideA_mod.push_back(new TH2F(name.Data(), title.Data(), kuNbFeeSide * fuNrOfChannelsPerFee, 0,
862 kuNbFeeSide * fuNrOfChannelsPerFee, 256, 0, 256));
863 name = Form("RemapTotSideB_mod_%02u", uMod);
864 title = Form("Raw TOT module %02u Side B; PADI channel; TOT [bin]", uMod);
865 fvhRemapTotSideB_mod.push_back(new TH2F(name.Data(), title.Data(), kuNbFeeSide * fuNrOfChannelsPerFee, 0,
866 kuNbFeeSide * fuNrOfChannelsPerFee, 256, 0, 256));
867
868 name = Form("ModRate_gDPB_m%02u", uMod);
869 title = Form("Counts per second in Module %02u; Time[s] ; Counts", uMod);
870 fvhModRate.push_back(new TH1D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
871
872 name = Form("ModErrorRate_m%02u", uMod);
873 title = Form("Error Counts per second in Module %02u; Time[s] ; Error Counts", uMod);
874 fvhModErrorRate.push_back(new TH1D(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
875
876 name = Form("ModErrorRatio_m%02u", uMod);
877 title = Form("Error to data ratio per second in Module %02u; Time[s] ; Error ratio[]", uMod);
878 fvhModErrorRatio.push_back(new TProfile(name.Data(), title.Data(), fuHistoryHistoSize, 0, fuHistoryHistoSize));
879 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
880
881 /*******************************************************************/
883 if (kTRUE == fbPulserModeEnable) {
885 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++) {
887 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++) {
888 if (uFeeA < uFeeB) {
889 UInt_t uGdpbA = uFeeA / (fuNrOfFeePerGdpb);
890 UInt_t uFeeIdA = uFeeA - (fuNrOfFeePerGdpb * uGdpbA);
891 UInt_t uGdpbB = uFeeB / (fuNrOfFeePerGdpb);
892 UInt_t uFeeIdB = uFeeB - (fuNrOfFeePerGdpb * uGdpbB);
893 fvhTimeDiffPulser[uFeeA][uFeeB] =
894 new TH1I(Form("hTimeDiffPulser_g%02u_f%1u_g%02u_f%1u", uGdpbA, uFeeIdA, uGdpbB, uFeeIdB),
895 Form("Time difference for pulser on gDPB %02u FEE %1u and "
896 "gDPB %02u FEE %1u; DeltaT [ps]; Counts",
897 uGdpbA, uFeeIdA, uGdpbB, uFeeIdB),
898 uNbBinsDt, dMinDt, dMaxDt);
899 } // if( uFeeA < uFeeB )
900 else
901 fvhTimeDiffPulser[uFeeA][uFeeB] = NULL;
902 } // for( UInt_t uFeeB = uFeeA; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs - 1; uFeeB++)
903 } // for( UInt_t uFeeA = 0; uFeeA < kuNbChanTest - 1; uFeeA++)
904
905 name = "hTimeMeanPulser";
906 fhTimeMeanPulser = new TH2D(name.Data(), "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
909
910 name = "hTimeRmsPulser";
911 fhTimeRmsPulser = new TH2D(name.Data(), "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
914
915 name = "hTimeRmsZoomFitPuls";
916 fhTimeRmsZoomFitPuls = new TH2D(name.Data(),
917 "Time difference RMS after zoom for each "
918 "FEE pairs; FEE A; FEE B ; RMS [ps]",
921
922 name = "hTimeResFitPuls";
923 fhTimeResFitPuls = new TH2D(name.Data(),
924 "Time difference Res from fit for each FEE "
925 "pairs; FEE A; FEE B ; Sigma [ps]",
928
931 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
932 for (UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx) {
933 name = Form("hPulserTimeDiffEvoGdpb%02uGbtx00Gbtx%02u", uGdpb, uGbtx + 1);
934 fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx] =
935 new TProfile(name.Data(),
936 Form("Time difference of the 1st FEE in the 1st GBTx of gDPB %02u "
937 "vs GBTx %02u; time in run [min]; dt [ps]",
938 uGdpb, uGbtx + 1),
940 } // for( UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb; ++uGbtx )
941
942 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb].resize(fuNrOfGdpbs, NULL);
943 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB < fuNrOfGdpbs; ++uGdpbB) {
944 name = Form("hPulserTimeDiffEvoGdpb%02uGdpb%02u", uGdpb, uGdpbB);
945 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpbB] =
946 new TProfile(name.Data(),
947 Form("Time difference of the 1st FEE in the 1st GBTx of "
948 "gDPB %02u vs %02u; time in run [min]; dt [ps]",
949 uGdpb, uGdpbB),
951 } // for( UInt_t uGdpbB = uGdpb + 1; uGdpbB < fuNrOfGdpbs; ++uGdpbB )
952 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
953 } // if( kTRUE == fbPulserModeEnable )
954
956 if (kTRUE == fbCoincMapsEnable) {
957 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
958 name = Form("hCoincMapAllChanGdpb%02u", uGdpb);
959 fvhCoincMapAllChanGdpb.push_back(new TH2D(name.Data(),
960 Form("Coincidence map of all channels of gDPB %02u; Chan A "
961 "[]; Chan B[]; Coinc. []",
962 uGdpb),
965
966 name = Form("hCoincMeanAllChanGdpb%02u", uGdpb);
967 fvhCoincMeanAllChanGdpb.push_back(new TProfile2D(name.Data(),
968 Form("Coincidence mean of all channels of gDPB %02u; "
969 "Chan A []; Chan B[]; Mean dt [ps]",
970 uGdpb),
973 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
974 } // if( kTRUE == fbCoincMapsEnable )
975
976 if (server) {
977 server->Register("/TofRaw", fhMessType);
978 server->Register("/TofRaw", fhSysMessType);
979 server->Register("/TofRaw", fhGet4MessType);
980 server->Register("/TofRaw", fhGet4ChanScm);
981 server->Register("/TofRaw", fhGet4ChanErrors);
982 server->Register("/TofRaw", fhGet4EpochFlags);
983
984 server->Register("/TofRaw", fhGdpbMessType);
985 server->Register("/TofRaw", fhGdpbSysMessType);
986 server->Register("/TofRaw", fhGdpbSysMessPattType);
987 server->Register("/TofRaw", fhGdpbEpochFlags);
988 server->Register("/TofRaw", fhGdpbEpochSyncEvo);
989 server->Register("/TofRaw", fhGdpbEpochMissEvo);
990
991 server->Register("/TofRaw", fhScmScalerCounters);
992 server->Register("/TofRaw", fhScmDeadtimeCounters);
993 server->Register("/TofRaw", fhScmSeuCounters);
994 server->Register("/TofRaw", fhScmSeuCountersEvo);
995
996 server->Register("/TofRaw", fhPatternMissmatch);
997 server->Register("/TofRaw", fhPatternEnable);
998 server->Register("/TofRaw", fhPatternResync);
999
1000 for (UInt_t uTotPlot = 0; uTotPlot < fvhRawTot_gDPB.size(); ++uTotPlot)
1001 server->Register("/TofRaw", fvhRawTot_gDPB[uTotPlot]);
1002
1003 for (UInt_t uTotPlot = 0; uTotPlot < fvhRemapTot_gDPB.size(); ++uTotPlot)
1004 server->Register("/TofRaw", fvhRemapTot_gDPB[uTotPlot]);
1005
1006 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
1007 server->Register("/TofRaw", fvhRemapTotSideA_mod[uMod]);
1008 server->Register("/TofRaw", fvhRemapTotSideB_mod[uMod]);
1009 server->Register("/TofMod", fvhModRate[uMod]);
1010 server->Register("/TofMod", fvhModErrorRate[uMod]);
1011 server->Register("/TofMod", fvhModErrorRatio[uMod]);
1012 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
1013
1014 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1015 server->Register("/TofRaw", fvhGdpbGet4MessType[uGdpb]);
1016 server->Register("/TofRaw", fvhGdpbGet4ChanScm[uGdpb]);
1017 server->Register("/TofRaw", fvhGdpbGet4ChanErrors[uGdpb]);
1018
1019 server->Register("/TofRaw", fvhGdpbPatternMissmatchEvo[uGdpb]);
1020 server->Register("/TofRaw", fvhGdpbPatternEnableEvo[uGdpb]);
1021 server->Register("/TofRaw", fvhGdpbPatternResyncEvo[uGdpb]);
1022
1023 server->Register("/TofRaw", fvhRawFt_gDPB[uGdpb]);
1024 server->Register("/TofRaw", fvhChCount_gDPB[uGdpb]);
1025 server->Register("/TofRates", fvhChannelRate_gDPB[uGdpb]);
1026 server->Register("/TofRaw", fvhRemapChCount_gDPB[uGdpb]);
1027 server->Register("/TofRates", fvhRemapChRate_gDPB[uGdpb]);
1028
1029 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
1030 server->Register("/TofRates", fvhFeeRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1031 server->Register("/TofRates", fvhFeeErrorRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1032 server->Register("/TofRates", fvhFeeErrorRatio_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1033 server->Register("/TofRates", fvhFeeRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1034 server->Register("/TofRates", fvhFeeErrorRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1035 server->Register("/TofRates", fvhFeeErrorRatioLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]);
1036 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++ uFee)
1037
1038 server->Register("/StarRaw", fvhTokenMsgType[uGdpb]);
1039 server->Register("/StarRaw", fvhTriggerRate[uGdpb]);
1040 server->Register("/StarRaw", fvhCmdDaqVsTrig[uGdpb]);
1041 server->Register("/StarRaw", fvhStarTokenEvo[uGdpb]);
1042 server->Register("/StarRaw", fvhStarTrigGdpbTsEvo[uGdpb]);
1043 server->Register("/StarRaw", fvhStarTrigStarTsEvo[uGdpb]);
1044 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1045
1046 if (kTRUE == fbPulserModeEnable) {
1047 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
1048 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
1049 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) server->Register("/TofDt", fvhTimeDiffPulser[uFeeA][uFeeB]);
1050
1051 server->Register("/TofRaw", fhTimeMeanPulser);
1052 server->Register("/TofRaw", fhTimeRmsPulser);
1053 server->Register("/TofRaw", fhTimeRmsZoomFitPuls);
1054 server->Register("/TofRaw", fhTimeResFitPuls);
1055
1056 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1057 for (UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx)
1058 if (NULL != fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx])
1059 server->Register("/TofDtEvo", fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx]);
1060
1061 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB < fuNrOfGdpbs; ++uGdpbB)
1062 if (NULL != fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpbB])
1063 server->Register("/TofDtEvo", fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpbB]);
1064 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1065 } // if( kTRUE == fbPulserModeEnable )
1066 if (kTRUE == fbCoincMapsEnable) {
1067 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1068 server->Register("/TofCoinc", fvhCoincMapAllChanGdpb[uGdpb]);
1069 server->Register("/TofCoinc", fvhCoincMeanAllChanGdpb[uGdpb]);
1070 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1071 } // if( kTRUE == fbCoincMapsEnable )
1072
1073 server->RegisterCommand("/Reset_All_eTOF", "bMcbmMoniTofResetHistos=kTRUE");
1074 server->RegisterCommand("/Save_All_eTof", "bMcbmMoniTofSaveHistos=kTRUE");
1075 server->RegisterCommand("/Update_PulsFit", "bMcbmMoniTofUpdateZoomedFit=kTRUE");
1076 server->RegisterCommand("/Print_Raw_Data", "bMcbmMoniTofRawDataPrint=kTRUE");
1077 server->RegisterCommand("/Print_AllHits", "bMcbmMoniTofPrintAllHitsEna=kTRUE");
1078 server->RegisterCommand("/Print_AllEps", "bMcbmMoniTofPrintAllEpochsEna=kTRUE");
1079
1080 server->Restrict("/Reset_All_eTof", "allow=admin");
1081 server->Restrict("/Save_All_eTof", "allow=admin");
1082 server->Restrict("/Update_PulsFit", "allow=admin");
1083 server->Restrict("/Print_Raw_Data", "allow=admin");
1084 server->Restrict("/Print_AllHits", "allow=admin");
1085 server->Restrict("/Print_AllEps", "allow=admin");
1086 } // if( server )
1087
1089 Double_t w = 10;
1090 Double_t h = 10;
1091 TCanvas* cSummary = new TCanvas("cSummary", "gDPB Monitoring Summary", w, h);
1092 cSummary->Divide(2, 3);
1093
1094 // 1st Column: Messages types
1095 cSummary->cd(1);
1096 gPad->SetLogy();
1097 fhMessType->Draw();
1098
1099 cSummary->cd(2);
1100 gPad->SetLogy();
1101 fhSysMessType->Draw();
1102
1103 cSummary->cd(3);
1104 gPad->SetLogz();
1105 fhGet4MessType->Draw("colz");
1106
1107 // 2nd Column: GET4 Errors + Epoch flags + SCm
1108 cSummary->cd(4);
1109 gPad->SetLogz();
1110 fhGet4ChanErrors->Draw("colz");
1111
1112 cSummary->cd(5);
1113 gPad->SetLogz();
1114 fhGet4EpochFlags->Draw("colz");
1115
1116 cSummary->cd(6);
1117 fhGet4ChanScm->Draw("colz");
1118 /*****************************/
1119
1121 TCanvas* cSummaryGdpb = new TCanvas("cSummaryGdpb", "gDPB Monitoring Summary", w, h);
1122 cSummaryGdpb->Divide(2, 3);
1123
1124 cSummaryGdpb->cd(1);
1125 gPad->SetLogz();
1126 fhGdpbMessType->Draw("colz");
1127
1128 cSummaryGdpb->cd(3);
1129 gPad->SetLogz();
1130 fhGdpbSysMessType->Draw("colz");
1131
1132 cSummaryGdpb->cd(5);
1133 gPad->SetLogz();
1134 fhGdpbEpochFlags->Draw("text colz");
1135
1136 cSummaryGdpb->cd(4);
1137 fhGdpbEpochSyncEvo->Draw("colz");
1138
1139 cSummaryGdpb->cd(6);
1140 gPad->SetLogz();
1141 fhGdpbEpochMissEvo->Draw("colz");
1142 /*****************************/
1143
1145 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1146 TCanvas* cSumGdpbGet4 =
1147 new TCanvas(Form("cSumGdpbGet4_g%02u", uGdpb), Form("Summary per GET4 or channel for gDPB %02u", uGdpb), w, h);
1148 cSumGdpbGet4->Divide(2, 2);
1149
1150 cSumGdpbGet4->cd(1);
1151 gPad->SetLogz();
1152 fvhGdpbGet4MessType[uGdpb]->Draw("colz");
1153
1154 cSumGdpbGet4->cd(2);
1155 gPad->SetLogz();
1156 fvhGdpbGet4ChanScm[uGdpb]->Draw("colz");
1157
1158 cSumGdpbGet4->cd(3);
1159 gPad->SetLogz();
1160 fvhGdpbGet4ChanErrors[uGdpb]->Draw("colz");
1161 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1162 /*****************************/
1163
1165 TCanvas* cFeeRates = new TCanvas("cFeeRates", "gDPB Monitoring FEE rates", w, h);
1166 // cFeeRates->Divide(fuNrOfFeePerGdpb, fuNrOfGdpbs );
1167 cFeeRates->Divide(kuNbFeePerGbtx, kuNbGbtxPerGdpb * fuNrOfGdpbs);
1168 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1169 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
1170 cFeeRates->cd(1 + uGdpb * fuNrOfFeePerGdpb + uFee);
1171 gPad->SetLogy();
1172 fvhFeeRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Draw("hist");
1173
1174 fvhFeeErrorRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->SetLineColor(kRed);
1175 fvhFeeErrorRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Draw("same hist");
1176 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee )
1177 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1178 /*****************************/
1179
1181 TCanvas* cFeeErrRatio = new TCanvas("cFeeErrRatio", "gDPB Monitoring FEE error ratios", w, h);
1182 // cFeeErrRatio->Divide(fuNrOfFeePerGdpb, fuNrOfGdpbs );
1183 cFeeErrRatio->Divide(kuNbFeePerGbtx, kuNbGbtxPerGdpb * fuNrOfGdpbs);
1184 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1185 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
1186 cFeeErrRatio->cd(1 + uGdpb * fuNrOfFeePerGdpb + uFee);
1187 gPad->SetLogy();
1188 fvhFeeErrorRatio_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Draw("hist le0");
1189 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee )
1190 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1191 /*****************************/
1192
1193
1195 TCanvas* cFeeRatesLong = new TCanvas("cFeeRatesLong", "gDPB Monitoring FEE rates", w, h);
1196 // cFeeRatesLong->Divide(fuNrOfFeePerGdpb, fuNrOfGdpbs );
1197 cFeeRatesLong->Divide(kuNbFeePerGbtx, kuNbGbtxPerGdpb * fuNrOfGdpbs);
1198 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1199 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
1200 cFeeRatesLong->cd(1 + uGdpb * fuNrOfFeePerGdpb + uFee);
1201 gPad->SetLogy();
1202 fvhFeeRateLong_gDPB[uGdpb]->Draw("hist");
1203
1204 fvhFeeErrorRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->SetLineColor(kRed);
1205 fvhFeeErrorRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Draw("same hist");
1206 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee )
1207 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1208 /*****************************/
1209
1211 TCanvas* cFeeErrRatioLong = new TCanvas("cFeeErrRatioLong", "gDPB Monitoring FEE error ratios", w, h);
1212 // cFeeErrRatioLong->Divide(fuNrOfFeePerGdpb, fuNrOfGdpbs );
1213 cFeeErrRatioLong->Divide(kuNbFeePerGbtx, kuNbGbtxPerGdpb * fuNrOfGdpbs);
1214 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1215 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
1216 cFeeErrRatioLong->cd(1 + uGdpb * fuNrOfFeePerGdpb + uFee);
1217 gPad->SetLogy();
1218 fvhFeeErrorRatioLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Draw("hist le0");
1219 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee )
1220 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1221 /*****************************/
1222
1224 TCanvas* cGdpbChannelCount = new TCanvas("cGdpbChannelCount", "Integrated Get4 channel counts per gDPB", w, h);
1225 cGdpbChannelCount->Divide(1, fuNrOfGdpbs);
1226 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1227 cGdpbChannelCount->cd(1 + uGdpb);
1228 gPad->SetGridx();
1229 gPad->SetGridy();
1230 gPad->SetLogy();
1231 fvhChCount_gDPB[uGdpb]->Draw();
1232 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1233 /*****************************/
1234
1236 TCanvas* cGdpbRemapChCount = new TCanvas("cGdpbRemapChCount", "Integrated PADI channel counts per gDPB", w, h);
1237 cGdpbRemapChCount->Divide(1, fuNrOfGdpbs);
1238 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1239 cGdpbRemapChCount->cd(1 + uGdpb);
1240 gPad->SetGridx();
1241 gPad->SetGridy();
1242 gPad->SetLogy();
1243 fvhRemapChCount_gDPB[uGdpb]->Draw();
1244 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1245 /*****************************/
1246
1248 TCanvas* cGdpbChannelRate = new TCanvas("cGdpbChannelRate", "Get4 channel rate per gDPB", w, h);
1249 cGdpbChannelRate->Divide(1, fuNrOfGdpbs);
1250 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1251 cGdpbChannelRate->cd(1 + uGdpb);
1252 gPad->SetGridx();
1253 gPad->SetGridy();
1254 gPad->SetLogz();
1255 fvhChannelRate_gDPB[uGdpb]->Draw("colz");
1256 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1257 /*****************************/
1258
1260 TCanvas* cGdpbRemapChRate = new TCanvas("cGdpbRemapChRate", "PADI channel rate per gDPB", w, h);
1261 cGdpbRemapChRate->Divide(1, fuNrOfGdpbs);
1262 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1263 cGdpbRemapChRate->cd(1 + uGdpb);
1264 gPad->SetGridx();
1265 gPad->SetGridy();
1266 gPad->SetLogz();
1267 fvhRemapChRate_gDPB[uGdpb]->Draw("colz");
1268 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1269 /*****************************/
1270
1272 TCanvas* cTotPnt = NULL;
1273 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1274 cTotPnt = new TCanvas(Form("cTot_g%02u", uGdpb), Form("gDPB %02u TOT distributions", uGdpb), w, h);
1275
1276 cTotPnt->cd();
1277 gPad->SetGridx();
1278 gPad->SetGridy();
1279 gPad->SetLogz();
1280
1281 fvhRawTot_gDPB[uGdpb]->Draw("colz");
1282 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1283 cTotPnt = new TCanvas("cTot_all", "TOT distributions", w, h);
1284 cTotPnt->Divide(fuNrOfGdpbs);
1285 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1286 cTotPnt->cd(1 + uGdpb);
1287 gPad->SetGridx();
1288 gPad->SetGridy();
1289 gPad->SetLogz();
1290
1291 fvhRawTot_gDPB[uGdpb]->Draw("colz");
1292 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1293
1294 /**************************************************/
1295
1297 cTotPnt = NULL;
1298 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1299 cTotPnt = new TCanvas(Form("cTotRemap_g%02u", uGdpb), Form("PADI ch gDPB %02u TOT distributions", uGdpb), w, h);
1300
1301 cTotPnt->cd();
1302 gPad->SetGridx();
1303 gPad->SetGridy();
1304 gPad->SetLogz();
1305
1306 fvhRemapTot_gDPB[uGdpb]->Draw("colz");
1307 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1308 cTotPnt = new TCanvas("cTotRemap_all", "TOT distributions", w, h);
1309 cTotPnt->Divide(fuNrOfGdpbs);
1310 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1311 cTotPnt->cd(1 + uGdpb);
1312 gPad->SetGridx();
1313 gPad->SetGridy();
1314 gPad->SetLogz();
1315
1316 fvhRemapTot_gDPB[uGdpb]->Draw("colz");
1317 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1318
1319 /**************************************************/
1320
1322 cTotPnt = NULL;
1323 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
1324 cTotPnt =
1325 new TCanvas(Form("cTotRemapSides_m%02u", uMod), Form("Sides ch module %02u TOT distributions", uMod), w, h);
1326 cTotPnt->Divide(1, 2);
1327
1328 cTotPnt->cd(1);
1329 gPad->SetGridx();
1330 gPad->SetGridy();
1331 gPad->SetLogz();
1332
1333 fvhRemapTotSideA_mod[uMod]->Draw("colz");
1334
1335 cTotPnt->cd(2);
1336 gPad->SetGridx();
1337 gPad->SetGridy();
1338 gPad->SetLogz();
1339 fvhRemapTotSideB_mod[uMod]->Draw("colz");
1340 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
1341
1342 /**************************************************/
1343
1345 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) {
1346 TCanvas* cStarToken =
1347 new TCanvas(Form("cStarToken_g%02u", uGdpb), Form("STAR token detection info for gDPB %02u", uGdpb), w, h);
1348 cStarToken->Divide(2, 2);
1349
1350 cStarToken->cd(1);
1351 fvhTriggerRate[uGdpb]->Draw();
1352
1353 cStarToken->cd(2);
1354 fvhCmdDaqVsTrig[uGdpb]->Draw("colz");
1355
1356 cStarToken->cd(3);
1357 fvhStarTokenEvo[uGdpb]->Draw();
1358
1359 cStarToken->cd(4);
1360 fvhStarTrigGdpbTsEvo[uGdpb]->Draw("hist le0");
1361 fvhStarTrigStarTsEvo[uGdpb]->SetLineColor(kRed);
1362 fvhStarTrigStarTsEvo[uGdpb]->Draw("same hist le0");
1363 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb ++)
1364 /*****************************/
1365
1366 if (kTRUE == fbPulserModeEnable) {
1368 TCanvas* cPulser =
1369 new TCanvas("cPulser", "Time difference RMS for pulser channels when FEE pulser mode is ON", w, h);
1370 cPulser->Divide(2, 2);
1371
1372 cPulser->cd(1);
1373 gPad->SetGridx();
1374 gPad->SetGridy();
1375 fhTimeRmsPulser->Draw("colz");
1376
1377 cPulser->cd(2);
1378 gPad->SetGridx();
1379 gPad->SetGridy();
1380 fhTimeMeanPulser->Draw("colz");
1381
1382 cPulser->cd(3);
1383 gPad->SetGridx();
1384 gPad->SetGridy();
1385 fhTimeRmsZoomFitPuls->Draw("colz");
1386
1387 cPulser->cd(4);
1388 gPad->SetGridx();
1389 gPad->SetGridy();
1390 fhTimeResFitPuls->Draw("colz");
1391 /*****************************/
1392
1394 TCanvas* cPulserEvo =
1395 new TCanvas("cPulserEvo", "Time difference evolution between 1st FEE of 1st GBTx of gDPB pairs", w, h);
1396 cPulserEvo->Divide(1, fuNrOfGdpbs - 1);
1397 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs - 1; uGdpb++) {
1398 cPulserEvo->cd(1 + uGdpb);
1399 gPad->SetGridx();
1400 gPad->SetGridy();
1401 if (NULL != fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpb + 1])
1402 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpb + 1]->Draw();
1403
1404 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs - 1; uGdpb ++)
1405 /*****************************/
1407 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) {
1408 TCanvas* cPulserEvoGbtx = new TCanvas(Form("cPulserEvoGbtx%02u", uGdpb),
1409 Form("Time difference evolution between 1st FEE of GBTx "
1410 "pairs in gDPB %02u",
1411 uGdpb),
1412 w, h);
1413 cPulserEvoGbtx->Divide(1, kuNbGbtxPerGdpb - 1);
1414
1415 for (UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx) {
1416 cPulserEvoGbtx->cd(1 + uGbtx);
1417 gPad->SetGridx();
1418 gPad->SetGridy();
1419
1420 if (NULL != fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx])
1421 fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx]->Draw();
1422 } // for( UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx )
1423 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb ++)
1424 /*****************************/
1425 } // if( kTRUE == fbPulserModeEnable )
1426
1428 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
1429 TCanvas* cModRates =
1430 new TCanvas(Form("cModRate_m%02u", uMod), Form("Hit and error Rates for module %02u", uMod), w, h);
1431 cModRates->cd();
1432 gPad->SetLogy();
1433 fvhModRate[uMod]->Draw("hist");
1434
1435 fvhModErrorRate[uMod]->SetLineColor(kRed);
1436 fvhModErrorRate[uMod]->Draw("same hist");
1437 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
1438 /*****************************/
1439
1441 // Try to recover canvas in case it was created already by another monitor
1442 // If not existing, create it
1443 fcMsSizeAll = dynamic_cast<TCanvas*>(gROOT->FindObject("cMsSizeAll"));
1444 if (NULL == fcMsSizeAll) {
1445 fcMsSizeAll = new TCanvas("cMsSizeAll", "Evolution of MS size in last 300 s", w, h);
1446 fcMsSizeAll->Divide(4, 3);
1447 LOG(info) << "Created MS size canvas in TOF monitor";
1448 } // if( NULL == fcMsSizeAll )
1449 else
1450 LOG(info) << "Recovered MS size canvas in TOF monitor";
1451
1452 LOG(info) << "Leaving CreateHistograms";
1453}
1454
1455Bool_t CbmStar2019MonitorTof::DoUnpack(const fles::Timeslice& ts, size_t component)
1456{
1458 LOG(info) << "Reset eTOF STAR histos ";
1460 bMcbmMoniTofResetHistos = kFALSE;
1461 } // if( bMcbmMoniTofResetHistos )
1463 LOG(info) << "Start saving eTOF STAR histos ";
1464 SaveAllHistos("data/histos_Shift_StarTof.root");
1465 bMcbmMoniTofSaveHistos = kFALSE;
1466 } // if( bSaveStsHistos )
1470 } // if (bMcbmMoniTofUpdateZoomedFit)
1473 bMcbmMoniTofRawDataPrint = kFALSE;
1474 } // if( bMcbmMoniTofRawDataPrint )
1478 } // if( bMcbmMoniTofPrintAllHitsEna )
1482 } // if( bMcbmMoniTofPrintAllEpochsEna )
1483
1485 std::chrono::time_point<std::chrono::system_clock> timeCurrent = std::chrono::system_clock::now();
1486 std::chrono::duration<double> elapsed_seconds = timeCurrent - fTimeLastHistoSaving;
1487 if (0 == fTimeLastHistoSaving.time_since_epoch().count()) {
1488 fTimeLastHistoSaving = timeCurrent;
1489 // fulNbBuiltSubEventLastPrintout = fulNbBuiltSubEvent;
1490 // fulNbStarSubEventLastPrintout = fulNbStarSubEvent;
1491 } // if( 0 == fTimeLastHistoSaving.time_since_epoch().count() )
1492 else if (300 < elapsed_seconds.count()) {
1493 std::time_t cTimeCurrent = std::chrono::system_clock::to_time_t(timeCurrent);
1494 char tempBuff[80];
1495 std::strftime(tempBuff, 80, "%F %T", localtime(&cTimeCurrent));
1496 /*
1497 LOG(info) << "CbmTofStarEventBuilder2018::DoUnpack => " << tempBuff
1498 << " Total number of Built events: " << std::setw(9) << fulNbBuiltSubEvent
1499 << ", " << std::setw(9) << (fulNbBuiltSubEvent - fulNbBuiltSubEventLastPrintout)
1500 << " events in last " << std::setw(4) << elapsed_seconds.count() << " s";
1501 fTimeLastPrintoutNbStarEvent = timeCurrent;
1502 fulNbBuiltSubEventLastPrintout = fulNbBuiltSubEvent;
1503*/
1504 fTimeLastHistoSaving = timeCurrent;
1505 SaveAllHistos("data/histos_shift.root");
1506 } // else if( 300 < elapsed_seconds.count() )
1507
1508 LOG(debug1) << "Timeslice contains " << ts.num_microslices(component) << "microslices.";
1509
1511 UInt_t uNbMsLoop = fuNbCoreMsPerTs;
1512 if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
1513
1514 Int_t messageType = -111;
1515 Double_t dTsStartTime = -1;
1516
1518 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1519 if (fuMsAcceptsPercent < uMsIdx) continue;
1520
1521 fuCurrentMs = uMsIdx;
1522
1523 if (0 == fulCurrentTsIndex && 0 == uMsIdx) {
1524 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
1525 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1526 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1527 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
1528 LOG(info) << Form(
1529 "%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx", static_cast<unsigned int>(msDescriptor.hdr_id),
1530 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
1531 static_cast<unsigned int>(msDescriptor.sys_id), static_cast<unsigned int>(msDescriptor.sys_ver),
1532 msDescriptor.idx, msDescriptor.crc, msDescriptor.size, msDescriptor.offset);
1533 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
1534 } // if( 0 == fulCurrentTsIndex && 0 == uMsIdx )
1535
1537 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
1538 constexpr uint32_t kuBytesPerMessage = 8;
1539
1540 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1541 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1542 fiEquipmentId = msDescriptor.eq_id;
1543 fdMsIndex = static_cast<double>(msDescriptor.idx);
1544 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
1545
1546 uint32_t size = msDescriptor.size;
1547 // fulLastMsIdx = msDescriptor.idx;
1548 if (size > 0) LOG(debug) << "Microslice: " << msDescriptor.idx << " has size: " << size;
1549 /*
1550 if( numCompMsInTs - fuOverlapMsNb <= m )
1551 {
1552// LOG(info) << "Ignore overlap Microslice: " << msDescriptor.idx;
1553 continue;
1554 } // if( numCompMsInTs - fuOverlapMsNb <= m )
1555*/
1556 if (0 == uMsIdx && 0 == uMsCompIdx) dTsStartTime = (1e-9) * fdMsIndex;
1557
1558 if (fdStartTimeMsSz < 0) fdStartTimeMsSz = (1e-9) * fdMsIndex;
1559 fvhMsSzPerLink[uMsComp]->Fill(size);
1560 if (2 * fuHistoryHistoSize < (1e-9) * fdMsIndex - fdStartTimeMsSz) {
1561 // Reset the evolution Histogram and the start time when we reach the end of the range
1562 fvhMsSzTimePerLink[uMsComp]->Reset();
1563 fdStartTimeMsSz = (1e-9) * fdMsIndex;
1564 } // if( 2 * fuHistoryHistoSize < (1e-9) * fdMsIndex - fdStartTimeMsSz )
1565 fvhMsSzTimePerLink[uMsComp]->Fill((1e-9) * fdMsIndex - fdStartTimeMsSz, size);
1566
1567 // If not integer number of message in input buffer, print warning/error
1568 if (0 != (size % kuBytesPerMessage))
1569 LOG(error) << "The input microslice buffer does NOT "
1570 << "contain only complete nDPB messages!";
1571
1572 // Compute the number of complete messages in the input microslice buffer
1573 uint32_t uNbMessages = (size - (size % kuBytesPerMessage)) / kuBytesPerMessage;
1574
1575 // Get the gDPB ID from the MS header
1577
1579 auto it = fGdpbIdIndexMap.find(fuGdpbId);
1580 if (it == fGdpbIdIndexMap.end()) {
1581 LOG(info) << "---------------------------------------------------------------";
1582 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
1583 LOG(info) << Form(
1584 "%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx", static_cast<unsigned int>(msDescriptor.hdr_id),
1585 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
1586 static_cast<unsigned int>(msDescriptor.sys_id), static_cast<unsigned int>(msDescriptor.sys_ver),
1587 msDescriptor.idx, msDescriptor.crc, msDescriptor.size, msDescriptor.offset);
1588 LOG(fatal) << "Could not find the gDPB index for AFCK id 0x" << std::hex << fuGdpbId << std::dec
1589 << " in timeslice " << fulCurrentTsIndex << " in microslice " << fdMsIndex << " component "
1590 << uMsCompIdx << "\n"
1591 << "If valid this index has to be added in the TOF "
1592 "parameter file in the RocIdArray field";
1593 continue;
1594 } // if( it == fGdpbIdIndexMap.end() )
1595 else
1597
1598 // Prepare variables for the loop on contents
1599 const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
1600 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
1601 // Fill message
1602 uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]);
1603
1605 if (0 == uIdx && kFALSE == fbOldFwData) {
1606 ProcessEpochCycle(ulData);
1607 continue;
1608 } // if( 0 == uIdx && kFALSE == fbOldFwData )
1609
1610 gdpbv100::Message mess(ulData);
1611
1612 if (fuRawDataPrintMsgIdx < fuRawDataPrintMsgNb || fair::Logger::Logging(fair::Severity::debug2)) {
1613 mess.printDataCout();
1615 }
1616
1617 // Increment counter for different message types
1618 // and fill the corresponding histogram
1619 messageType = mess.getMessageType();
1620 fviMsgCounter[messageType]++;
1621 fhMessType->Fill(messageType);
1622 fhGdpbMessType->Fill(messageType, fuGdpbNr);
1623
1627 if (fuGdpbNr == fuDiamondDpbIdx) fuGet4Id = mess.getGdpbGenChipId();
1629
1631 LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS " << fuNrOfGet4PerGdpb
1632 << " set in parameters.";
1633
1634 switch (messageType) {
1635 case gdpbv100::MSG_HIT: {
1636 if (mess.getGdpbHitIs24b()) {
1637 fhGet4MessType->Fill(fuGet4Nr, 4);
1639 PrintGenInfo(mess);
1640 } // if( getGdpbHitIs24b() )
1641 else {
1642 fhGet4MessType->Fill(fuGet4Nr, 0);
1644 fvmEpSupprBuffer[fuGet4Nr].push_back(mess);
1645 } // else of if( getGdpbHitIs24b() )
1646 break;
1647 } // case gdpbv100::MSG_HIT:
1648 case gdpbv100::MSG_EPOCH: {
1650 if (1 == mess.getGdpbEpSync()) {
1651 fhGdpbEpochFlags->Fill(fuGdpbNr, 0);
1653 } // if (1 == mess.getGdpbEpSync())
1654
1655 if (1 == mess.getGdpbEpDataLoss()) fhGdpbEpochFlags->Fill(fuGdpbNr, 1);
1656
1657 if (1 == mess.getGdpbEpEpochLoss()) fhGdpbEpochFlags->Fill(fuGdpbNr, 2);
1658
1659 if (1 == mess.getGdpbEpMissmatch()) {
1660 fhGdpbEpochFlags->Fill(fuGdpbNr, 3);
1662 } // if (1 == mess.getGdpbEpMissmatch())
1663
1664 for (uint32_t uGet4Index = 0; uGet4Index < fuNrOfGet4PerGdpb; uGet4Index++) {
1665 fuGet4Id = uGet4Index;
1667 gdpbv100::Message tmpMess(mess);
1668 tmpMess.setGdpbGenChipId(uGet4Index);
1669
1670 fhGet4MessType->Fill(fuGet4Nr, 1);
1672 FillEpochInfo(tmpMess);
1673 } // for( uint32_t uGet4Index = 0; uGet4Index < fuNrOfGet4PerGdpb; uGetIndex ++ )
1674
1675 if (kTRUE == fbPrintAllEpochsEnable) {
1676 LOG(info) << "Epoch: " << Form("0x%08x ", fuGdpbId) << ", Merg"
1677 << ", Link " << std::setw(1) << mess.getGdpbEpLinkId() << ", epoch " << std::setw(8)
1678 << mess.getGdpbEpEpochNb() << ", Sync " << std::setw(1) << mess.getGdpbEpSync()
1679 << ", Data loss " << std::setw(1) << mess.getGdpbEpDataLoss() << ", Epoch loss "
1680 << std::setw(1) << mess.getGdpbEpEpochLoss() << ", Epoch miss " << std::setw(1)
1681 << mess.getGdpbEpMissmatch();
1682 } // if( kTRUE == fbPrintAllEpochsEnable )
1683 } // if this epoch message is a merged one valid for all chips
1684 else {
1685 fhGet4MessType->Fill(fuGet4Nr, 1);
1688 // FillEpochInfo(mess);
1689
1690 if (kTRUE == fbPrintAllEpochsEnable) {
1691 LOG(info) << "Epoch: " << Form("0x%08x ", fuGdpbId) << ", " << std::setw(4) << fuGet4Nr << ", Link "
1692 << std::setw(1) << mess.getGdpbEpLinkId() << ", epoch " << std::setw(8)
1693 << mess.getGdpbEpEpochNb() << ", Sync " << std::setw(1) << mess.getGdpbEpSync()
1694 << ", Data loss " << std::setw(1) << mess.getGdpbEpDataLoss() << ", Epoch loss "
1695 << std::setw(1) << mess.getGdpbEpEpochLoss() << ", Epoch miss " << std::setw(1)
1696 << mess.getGdpbEpMissmatch();
1697 } // if( kTRUE == fbPrintAllEpochsEnable )
1698 } // if single chip epoch message
1699 break;
1700 } // case gdpbv100::MSG_EPOCH:
1701 case gdpbv100::MSG_SLOWC: {
1702 fhGet4MessType->Fill(fuGet4Nr, 2);
1704 PrintSlcInfo(mess);
1705 break;
1706 } // case gdpbv100::MSG_SLOWC:
1707 case gdpbv100::MSG_SYST: {
1708 fhSysMessType->Fill(mess.getGdpbSysSubType());
1711 fhGet4MessType->Fill(fuGet4Nr, 3);
1713
1714 UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
1715 if (0 <= fdStartTime) {
1719 1e-9 * (mess.getMsgFullTimeD(fvulCurrentEpoch[fuGet4Nr]) - fdStartTime), 1, 1);
1720
1721 UInt_t uGbtxNr = (uFeeNr / kuNbFeePerGbtx);
1722 UInt_t uGbtxNrInSys = fuGdpbNr * kuNbGbtxPerGdpb + uGbtxNr;
1723 fvhModErrorRate[fviModuleId[uGbtxNrInSys]]->Fill(
1725 fvhModErrorRatio[fviModuleId[uGbtxNrInSys]]->Fill(
1726 1e-9 * (mess.getMsgFullTimeD(fvulCurrentEpoch[fuGet4Nr]) - fdStartTime), 1, 1);
1727 } // if (0 <= fdStartTime)
1728 if (0 <= fdStartTimeLong) {
1730 1e-9 / 60.0 * (mess.getMsgFullTimeD(fvulCurrentEpoch[fuGet4Nr]) - fdStartTimeLong), 1 / 60.0);
1732 1e-9 / 60.0 * (mess.getMsgFullTimeD(fvulCurrentEpoch[fuGet4Nr]) - fdStartTimeLong), 1, 1 / 60.0);
1733 } // if (0 <= fdStartTime)
1734
1735 Int_t dGdpbChId = fuGet4Id * fuNrOfChannelsPerGet4 + mess.getGdpbSysErrChanId();
1736 Int_t dFullChId = fuGet4Nr * fuNrOfChannelsPerGet4 + mess.getGdpbSysErrChanId();
1737 switch (mess.getGdpbSysErrData()) {
1739 fhGet4ChanErrors->Fill(dFullChId, 0);
1740 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 0);
1741 break;
1743 fhGet4ChanErrors->Fill(dFullChId, 1);
1744 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 1);
1745 break;
1747 fhGet4ChanErrors->Fill(dFullChId, 2);
1748 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 2);
1749 break;
1751 fhGet4ChanErrors->Fill(dFullChId, 3);
1752 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 3);
1753 break;
1755 fhGet4ChanErrors->Fill(dFullChId, 4);
1756 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 4);
1757 break;
1759 fhGet4ChanErrors->Fill(dFullChId, 5);
1760 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 5);
1761 break;
1763 fhGet4ChanErrors->Fill(dFullChId, 6);
1764 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 6);
1765 break;
1767 fhGet4ChanErrors->Fill(dFullChId, 7);
1768 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 7);
1769 break;
1771 fhGet4ChanErrors->Fill(dFullChId, 8);
1772 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 8);
1773 break;
1775 fhGet4ChanErrors->Fill(dFullChId, 9);
1776 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 9);
1777 break;
1779 fhGet4ChanErrors->Fill(dFullChId, 10);
1780 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 10);
1781 break;
1783 fhGet4ChanErrors->Fill(dFullChId, 11);
1784 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 11);
1785 break;
1787 fhGet4ChanErrors->Fill(dFullChId, 12);
1788 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 12);
1789 break;
1791 fhGet4ChanErrors->Fill(dFullChId, 13);
1792 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 13);
1793 break;
1795 fhGet4ChanErrors->Fill(dFullChId, 14);
1796 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 14);
1797 break;
1799 fhGet4ChanErrors->Fill(dFullChId, 15);
1800 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 15);
1801 break;
1803 fhGet4ChanErrors->Fill(dFullChId, 16);
1804 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 16);
1805 break;
1807 fhGet4ChanErrors->Fill(dFullChId, 17);
1808 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 17);
1809 break;
1811 fhGet4ChanErrors->Fill(dFullChId, 18);
1812 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 18);
1813 break;
1815 fhGet4ChanErrors->Fill(dFullChId, 19);
1816 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 19);
1817 break;
1819 fhGet4ChanErrors->Fill(dFullChId, 20);
1820 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 20);
1821 break;
1822 default: // Corrupt error or not yet supported error
1823 fhGet4ChanErrors->Fill(dFullChId, 21);
1824 fvhGdpbGet4ChanErrors[fuGdpbNr]->Fill(dGdpbChId, 21);
1825 break;
1826 } // Switch( mess.getGdpbSysErrData() )
1827 } // if( gdpbv100::SYSMSG_GET4_EVENT == mess.getGdpbSysSubType() )
1830 FillPattInfo(mess);
1831 } // if( gdpbv100::SYS_PATTERN == mess.getGdpbSysSubType() )
1832 PrintSysInfo(mess);
1833 break;
1834 } // case gdpbv100::MSG_SYST:
1839 // fhGet4MessType->Fill(fuGet4Nr, 5);
1840 FillStarTrigInfo(mess);
1841 break;
1842 default:
1843 LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1844 << " not included in Get4 unpacker.";
1845 } // switch( mess.getMessageType() )
1846 } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
1847 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
1848
1850 if (kTRUE == fbPulserModeEnable) {
1852 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; ++uFeeA) {
1853 if (1 != fvuFeeNbHitsLastMs[uFeeA]) {
1855 fvuFeeNbHitsLastMs[uFeeA] = 0;
1856 continue;
1857 } // if( 1 != fvuFeeNbHitsLastMs[ uFeeA ] )
1858
1859 UInt_t uGdpbNr = uFeeA / fuNrOfFeePerGdpb;
1860 UInt_t uGbtxNr = uFeeA / kuNbFeePerGbtx;
1862 for (UInt_t uFeeB = uFeeA + 1; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; ++uFeeB) {
1863 if (1 != fvuFeeNbHitsLastMs[uFeeB]) continue;
1864
1865 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) {
1866 Double_t dTimeDiff = 1e3 * (fdTsLastPulserHit[uFeeB] - fdTsLastPulserHit[uFeeA]);
1867 if (TMath::Abs(dTimeDiff) < kdMaxDtPulserPs) {
1868 fvhTimeDiffPulser[uFeeA][uFeeB]->Fill(dTimeDiff);
1869
1871 if (0 == uFeeA % kuNbFeePerGbtx && 0 == uFeeB % kuNbFeePerGbtx) {
1873 if (uGdpbNr == uFeeB / fuNrOfFeePerGdpb) {
1874 if (0 == uGbtxNr) {
1875 UInt_t uPlotIdx =
1876 uGdpbNr * (kuNbGbtxPerGdpb - 1) + (uFeeB - uGdpbNr * fuNrOfFeePerGdpb) / kuNbFeePerGbtx - 1;
1877 fvhPulserTimeDiffEvoGbtxGbtx[uPlotIdx]->Fill(1e-9 / 60.0 * (fdTsLastPulserHit[uFeeA] - fdStartTime),
1878 dTimeDiff);
1879 } // if( 0 == uGbtxNr )
1880 } // if( uGdpbNr == uFeeB / fuNrOfFeePerGdpb )
1881 else // if( NULL != fvvhPulserTimeDiffEvoGdpbGdpb[ uFeeB / fuNrOfFeePerGdpb ][ uGdpbNr ] )
1882 {
1884 if (0 == uGbtxNr && 0 == uFeeB / kuNbFeePerGbtx)
1885 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpbNr][uFeeB / fuNrOfFeePerGdpb]->Fill(
1886 1e-9 / 60.0 * (fdTsLastPulserHit[uFeeA] - fdStartTime), dTimeDiff);
1887 } // else of if( uGdpbNr == uFeeB / fuNrOfFeePerGdpb )
1888 } // if( 0 == uFeeA % kuNbFeePerGbtx && 0 == uFeeB % kuNbFeePerGbtx )
1889 } // if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
1890 // else if( 10 == uFeeA && 20 == uFeeB )
1891 // LOG(info) << "new in 10 " << dTimeDiff;
1892 } // if( NULL != fvhTimeDiffPulser[uFeeA][uFeeB] )
1893 } // for( UInt_t uFeeB = uFeeA + 1; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; ++uFeeB)
1894
1896 fvuFeeNbHitsLastMs[uFeeA] = 0;
1897 } // for( UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; ++uFeeA)
1898 } // if( kTRUE == fbPulserModeEnable )
1899
1900 if (kTRUE == fbCoincMapsEnable) {
1901 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1902 for (UInt_t uChanA = 0; uChanA < fuNrOfChannelsPerGdpb; ++uChanA) {
1903 if (0 == fvuCoincNbHitsLastMs[uGdpb][uChanA]) {
1905 continue;
1906 } // if( 0 == fvuCoincNbHitsLastMs[ uGdpb ][ uChanA ] )
1907
1908 for (UInt_t uChanB = uChanA + 1; uChanB < fuNrOfChannelsPerGdpb; ++uChanB) {
1909 if (0 == fvuCoincNbHitsLastMs[uGdpb][uChanB]) {
1911 continue;
1912 } // if( 0 == fvuCoincNbHitsLastMs[ uGdpb ][ uChanB ] )
1913
1914 Double_t dTimeDiff = 1e3 * (fvdCoincTsLastHit[uGdpb][uChanB] - fvdCoincTsLastHit[uGdpb][uChanA]);
1915
1916 fvhCoincMeanAllChanGdpb[uGdpb]->Fill(uChanA, uChanB, dTimeDiff);
1917
1918 if (TMath::Abs(dTimeDiff) < kdMaxDtPulserPs) {
1919 fvhCoincMapAllChanGdpb[uGdpb]->Fill(uChanA, uChanB);
1920 } // if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
1921 } // for( UInt_t uChanA = 0; uChanA < fuNrOfChannelsPerGdpb; ++uChan A )
1922
1924 fvuCoincNbHitsLastMs[uGdpb][uChanA] = 0;
1925 } // for( UInt_t uChanA = 0; uChanA < fuNrOfChannelsPerGdpb; ++uChan A )
1926 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1927 } // if( kTRUE == fbCoincMapsEnable )
1928 } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
1929
1930 // Update RMS plots only every 10s in data
1931 if (kTRUE == fbPulserModeEnable) {
1932 if (10.0 < dTsStartTime - fdLastRmsUpdateTime) {
1933 // Reset summary histograms for safety
1934 fhTimeMeanPulser->Reset();
1935 fhTimeRmsPulser->Reset();
1936
1937 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
1938 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
1939 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) {
1940 fhTimeMeanPulser->Fill(uFeeA, uFeeB, fvhTimeDiffPulser[uFeeA][uFeeB]->GetMean());
1941 fhTimeRmsPulser->Fill(uFeeA, uFeeB, fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS());
1942 } // for( UInt_t uChan = 0; uChan < kuNbChanTest - 1; uChan++)
1944 } // if( 10.0 < dTsStartTime - fdLastRmsUpdateTime )
1945 } // if( kTRUE == fbPulserModeEnable )
1946
1948
1949 return kTRUE;
1950}
1951
1953{
1954 uint64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz;
1955
1956 if (fuRawDataPrintMsgIdx < fuRawDataPrintMsgNb || fair::Logger::Logging(fair::Severity::debug2)) {
1957 LOG(info) << "CbmMcbm2018MonitorTof::ProcessEpochCyle => "
1958 << Form(" TS %5lu MS %3lu In data 0x%016lX Cycle 0x%016lX", fulCurrentTsIndex, fuCurrentMs, ulCycleData,
1959 ulEpochCycleVal);
1961 }
1962
1963 for (uint32_t uGet4Index = 0; uGet4Index < fuNrOfGet4PerGdpb; uGet4Index++) {
1964 fuGet4Id = uGet4Index;
1966 /*
1967 if( !( ulEpochCycleVal == fvulCurrentEpochCycle[fuGet4Nr] ||
1968 ulEpochCycleVal == fvulCurrentEpochCycle[fuGet4Nr] + 1 ) )
1969 LOG(error) << "CbmMcbm2018MonitorTof::ProcessEpochCyle => "
1970 << " Missmatch in epoch cycles detected, probably fake cycles due to epoch index corruption! "
1971 << Form( " Current cycle 0x%09X New cycle 0x%09X", fvulCurrentEpochCycle[fuGet4Nr], ulEpochCycleVal );
1972*/
1973 fvulCurrentEpochCycle[fuGet4Nr] = ulEpochCycleVal;
1974 } // for( uint32_t uGet4Index = 0; uGet4Index < fuNrOfGet4PerGdpb; uGet4Index ++ )
1975 return;
1976}
1977
1979{
1980 UInt_t uChannel = mess.getGdpbHitChanId();
1981 UInt_t uTot = mess.getGdpbHit32Tot();
1982 UInt_t uFts = mess.getGdpbHitFineTs();
1983
1984 ULong64_t ulCurEpochGdpbGet4 = fvulCurrentEpoch[fuGet4Nr];
1985
1986 // In Ep. Suppr. Mode, receive following epoch instead of previous
1987 if (0 < ulCurEpochGdpbGet4) ulCurEpochGdpbGet4--;
1988 else
1989 ulCurEpochGdpbGet4 = gdpbv100::kuEpochCounterSz; // Catch epoch cycle!
1990
1991 UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1992 UInt_t uChannelNrInFee = (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel;
1993 UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
1994 UInt_t uFeeNrInSys = fuGdpbNr * fuNrOfFeePerGdpb + uFeeNr;
1995 UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + fvuGet4ToPadi[uChannelNrInFee];
1996 UInt_t uGbtxNr = (uFeeNr / kuNbFeePerGbtx);
1997 UInt_t uFeeInGbtx = (uFeeNr % kuNbFeePerGbtx);
1998 UInt_t uGbtxNrInSys = fuGdpbNr * kuNbGbtxPerGdpb + uGbtxNr;
1999
2000 ULong_t ulHitTime = mess.getMsgFullTime(ulCurEpochGdpbGet4);
2001 Double_t dHitTime = mess.getMsgFullTimeD(ulCurEpochGdpbGet4);
2002
2003 // In 32b mode the coarse counter is already computed back to 112 FTS bins
2004 // => need to hide its contribution from the Finetime
2005 // => FTS = Fullt TS modulo 112
2006 uFts = mess.getGdpbHitFullTs() % 112;
2007
2008 fvhChCount_gDPB[fuGdpbNr]->Fill(uChannelNr);
2009 fvhRawFt_gDPB[fuGdpbNr]->Fill(uChannelNr, uFts);
2010 fvhRawTot_gDPB[fuGdpbNr]->Fill(uChannelNr, uTot);
2011
2013 fvhRemapChCount_gDPB[fuGdpbNr]->Fill(uRemappedChannelNr);
2014 fvhRemapTot_gDPB[fuGdpbNr]->Fill(uRemappedChannelNr, uTot);
2015
2016 if (uGbtxNrInSys < fuNrOfGbtx) {
2017 UInt_t uOffset = uGbtxNrInSys * kuNbFeeSide * fuNrOfChannelsPerFee;
2018 if (fviRpcSide[uGbtxNrInSys])
2019 fvhRemapTotSideB_mod[fviModuleId[uGbtxNrInSys]]->Fill(uRemappedChannelNr - uOffset, uTot);
2020 else
2021 fvhRemapTotSideA_mod[fviModuleId[uGbtxNrInSys]]->Fill(uRemappedChannelNr - uOffset, uTot);
2022 } // if( uGbtxNrInSys < fuNrOfGbtx )
2023 /*
2024 switch( ( uRemappedChannelNr / fuNrOfChannelsPerFee ) / kuNbFeeSide )
2025 {
2026 case 0: // Module 1 Side A
2027 fvhRemapTotSideA_mod[ fuGdpbNr ]->Fill( uRemappedChannelNr , uTot);
2028 case 1: // Module 1 Side B
2029 fvhRemapTotSideB_mod[ fuGdpbNr ]->Fill( uRemappedChannelNr - 160 , uTot);
2030 case 2: // Module 2 Side A
2031 fvhRemapTotSideA_mod[ fuGdpbNr ]->Fill( uRemappedChannelNr - 160 , uTot);
2032 case 3: // Module 2 Side B
2033 fvhRemapTotSideB_mod[ fuGdpbNr ]->Fill( uRemappedChannelNr - 320, uTot);
2034 } // switch( ( uRemappedChannelNr / fuNrOfChannelsPerFee ) % kuNbFeeSide )
2035*/
2036 // In Run rate evolution
2037 if (fdStartTime < 0) fdStartTime = dHitTime;
2038
2039 // Reset the evolution Histogram and the start time when we reach the end of the range
2040 if (fuHistoryHistoSize < 1e-9 * (dHitTime - fdStartTime)) {
2042 fdStartTime = dHitTime;
2043 } // if( fuHistoryHistoSize < 1e-9 * (dHitTime - fdStartTime) )
2044
2045 // In Run rate evolution
2046 if (fdStartTimeLong < 0) fdStartTimeLong = dHitTime;
2047
2048 // Reset the evolution Histogram and the start time when we reach the end of the range
2049 if (fuHistoryHistoSizeLong < 1e-9 * (dHitTime - fdStartTimeLong) / 60.0) {
2051 fdStartTimeLong = dHitTime;
2052 } // if( fuHistoryHistoSize < 1e-9 * (dHitTime - fdStartTime) / 60.0 )
2053
2055 if (kTRUE == fbPulserModeEnable) {
2058 if (gdpbv100::kuFeePulserChannel == uChannelNrInFee) {
2059 fdTsLastPulserHit[uFeeNrInSys] = dHitTime;
2060 fvuFeeNbHitsLastMs[uFeeNrInSys]++;
2061 /*
2063 for( UInt_t uFeeB = 0; uFeeB < uFeeNrInSys; uFeeB++)
2064 if( NULL != fvhTimeDiffPulser[uFeeB][uFeeNrInSys] )
2065 {
2066 Double_t dTimeDiff = 1e3 * ( fdTsLastPulserHit[ uFeeNrInSys ] - fdTsLastPulserHit[ uFeeB ] );
2067 if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
2068 {
2069 fvhTimeDiffPulser[uFeeB][uFeeNrInSys]->Fill( dTimeDiff );
2070
2072 if( 0 == uFeeInGbtx && 0 == uFeeB % kuNbFeePerGbtx )
2073 {
2075 if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2076 {
2077 if( 0 == uFeeB / kuNbFeePerGbtx )
2078 {
2079 UInt_t uPlotIdx = fuGdpbNr * ( kuNbGbtxPerGdpb - 1) + uGbtxNr - 1;
2080 fvhPulserTimeDiffEvoGbtxGbtx[ uPlotIdx ]->Fill( 1e-9 / 60.0 * (dHitTime - fdStartTime), dTimeDiff );
2081 }
2082 } // if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2083 else // if( NULL != fvvhPulserTimeDiffEvoGdpbGdpb[ uFeeB / fuNrOfFeePerGdpb ][ fuGdpbNr ] )
2084 {
2086 if( 0 == uGbtxNr && 0 == uFeeB / kuNbFeePerGbtx )
2087 fvvhPulserTimeDiffEvoGdpbGdpb[ uFeeB / fuNrOfFeePerGdpb ][ fuGdpbNr ]->Fill(
2088 1e-9 / 60.0 * (dHitTime - fdStartTime), dTimeDiff );
2089 } // else of if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2090 } // if( 0 == uFeeInGbtx && 0 == uFeeB % kuNbFeePerGbtx )
2091 } // if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
2092 // else if( 10 == uFeeB && 20 == uFeeNrInSys )
2093 // LOG(info) << "new in 20 " << dTimeDiff;
2094 } // if( NULL != fvhTimeDiffPulser[uFeeB][uFeeB] )
2095
2097 for( UInt_t uFeeB = uFeeNrInSys + 1; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
2098 if( NULL != fvhTimeDiffPulser[uFeeNrInSys][uFeeB] )
2099 {
2100 Double_t dTimeDiff = 1e3 * ( fdTsLastPulserHit[ uFeeB ] - fdTsLastPulserHit[ uFeeNrInSys ] );
2101 if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
2102 {
2103 fvhTimeDiffPulser[uFeeNrInSys][uFeeB]->Fill( dTimeDiff );
2104
2106 if( 0 == uFeeInGbtx && 0 == uFeeB % kuNbFeePerGbtx )
2107 {
2109 if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2110 {
2111 if( 0 == uGbtxNr )
2112 {
2113 UInt_t uPlotIdx = fuGdpbNr * ( kuNbGbtxPerGdpb - 1)
2114 + ( uFeeB - fuGdpbNr * fuNrOfFeePerGdpb) / kuNbFeePerGbtx - 1;
2115 fvhPulserTimeDiffEvoGbtxGbtx[ uPlotIdx ]->Fill( 1e-9 / 60.0 * (dHitTime - fdStartTime), dTimeDiff );
2116 } // if( 0 == uGbtxNr )
2117 } // if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2118 else // if( NULL != fvvhPulserTimeDiffEvoGdpbGdpb[ uFeeB / fuNrOfFeePerGdpb ][ fuGdpbNr ] )
2119 {
2121 if( 0 == uGbtxNr && 0 == uFeeB / kuNbFeePerGbtx )
2122 fvvhPulserTimeDiffEvoGdpbGdpb[ fuGdpbNr ][ uFeeB / fuNrOfFeePerGdpb ]->Fill(
2123 1e-9 / 60.0 * (dHitTime - fdStartTime), dTimeDiff );
2124 } // else of if( fuGdpbNr == uFeeB / fuNrOfFeePerGdpb )
2125 } // if( 0 == uFeeInGbtx && 0 == uFeeB % kuNbFeePerGbtx )
2126 } // if( TMath::Abs( dTimeDiff ) < kdMaxDtPulserPs )
2127 // else if( 10 == uFeeNrInSys && 20 == uFeeB )
2128 // LOG(info) << "new in 10 " << dTimeDiff;
2129 } // if( NULL != fvhTimeDiffPulser[uFeeNrInSys][uFeeB] )
2130*/
2131 } // if( gdpbv100::kuFeePulserChannel == uChannelNrInFee )
2133 else if (fuGdpbNr == fuDiamondDpbIdx && 0 == uChannelNrInFee) {
2134 fdTsLastPulserHit[uFeeNrInSys] = dHitTime;
2135 fvuFeeNbHitsLastMs[uFeeNrInSys]++;
2136 } // if( fuGdpbNr == fuDiamondDpbIdx && 0 == uChannelNrInFee )
2137 } // if( kTRUE == fbPulserModeEnable )
2138
2140 if (kTRUE == fbCoincMapsEnable) {
2141 fvdCoincTsLastHit[fuGdpbNr][uRemappedChannelNr] = dHitTime;
2142 fvuCoincNbHitsLastMs[fuGdpbNr][uRemappedChannelNr]++;
2143 } // if( kTRUE == fbCoincMapsEnable )
2144
2145 if (0 <= fdStartTime) {
2146 fvhChannelRate_gDPB[fuGdpbNr]->Fill(1e-9 * (dHitTime - fdStartTime), uChannelNr);
2147 fvhRemapChRate_gDPB[fuGdpbNr]->Fill(1e-9 * (dHitTime - fdStartTime), uRemappedChannelNr);
2148 fvhFeeRate_gDPB[(fuGdpbNr * fuNrOfFeePerGdpb) + uFeeNr]->Fill(1e-9 * (dHitTime - fdStartTime));
2149 fvhFeeErrorRatio_gDPB[(fuGdpbNr * fuNrOfFeePerGdpb) + uFeeNr]->Fill(1e-9 * (dHitTime - fdStartTime), 0, 1);
2150
2151 fvhModRate[fviModuleId[uGbtxNrInSys]]->Fill(1e-9 * (dHitTime - fdStartTime));
2152 fvhModErrorRatio[fviModuleId[uGbtxNrInSys]]->Fill(1e-9 * (dHitTime - fdStartTime), 0, 1);
2153 } // if (0 <= fdStartTime)
2154
2155 if (0 <= fdStartTimeLong) {
2156 fvhFeeRateLong_gDPB[(fuGdpbNr * fuNrOfFeePerGdpb) + uFeeNr]->Fill(1e-9 / 60.0 * (dHitTime - fdStartTimeLong),
2157 1 / 60.0);
2158 fvhFeeErrorRatioLong_gDPB[(fuGdpbNr * fuNrOfFeePerGdpb) + uFeeNr]->Fill(1e-9 / 60.0 * (dHitTime - fdStartTimeLong),
2159 0, 1 / 60.0);
2160 } // if (0 <= fdStartTimeLong)
2161
2162 if (kTRUE == fbPrintAllHitsEnable) {
2163 LOG(info) << "Hit: " << Form("0x%08x ", fuGdpbId) << ", " << std::setw(2) << fuGet4Nr << ", " << std::setw(3)
2164 << uChannel << ", " << std::setw(3) << uTot << ", epoch " << std::setw(3) << ulCurEpochGdpbGet4
2165 << ", FullTime Clk " << Form("%12lu ", ulHitTime) << ", FullTime s " << Form("%12.9f ", dHitTime / 1e9)
2166 << ", FineTime " << uFts;
2167 } // if( kTRUE == fbPrintAllHitsEnable )
2168}
2169
2171{
2172 ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
2173 /*
2174 if( fvulCurrentEpoch[fuGet4Nr] < ulEpochNr )
2175 fvulCurrentEpochCycle[fuGet4Nr]++;
2176*/
2177 fvulCurrentEpoch[fuGet4Nr] = ulEpochNr;
2179
2180 if (1 == mess.getGdpbEpSync()) fhGet4EpochFlags->Fill(fuGet4Nr, 0);
2181 if (1 == mess.getGdpbEpDataLoss()) fhGet4EpochFlags->Fill(fuGet4Nr, 1);
2182 if (1 == mess.getGdpbEpEpochLoss()) fhGet4EpochFlags->Fill(fuGet4Nr, 2);
2183 if (1 == mess.getGdpbEpMissmatch()) fhGet4EpochFlags->Fill(fuGet4Nr, 3);
2184
2185 fulCurrentEpochTime = mess.getMsgFullTime(ulEpochNr);
2186
2189 if (0 < ulEpochNr) mess.setGdpbEpEpochNb(ulEpochNr - 1);
2190 else
2192
2193 Int_t iBufferSize = fvmEpSupprBuffer[fuGet4Nr].size();
2194 if (0 < iBufferSize) {
2195 LOG(debug) << "Now processing stored messages for for get4 " << fuGet4Nr << " with epoch number "
2196 << (fvulCurrentEpoch[fuGet4Nr] - 1);
2197
2200 std::stable_sort(fvmEpSupprBuffer[fuGet4Nr].begin(), fvmEpSupprBuffer[fuGet4Nr].begin());
2201
2202 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
2204 } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
2205
2206 fvmEpSupprBuffer[fuGet4Nr].clear();
2207 } // if( 0 < fvmEpSupprBuffer[fuGet4Nr] )
2208}
2209
2211{
2212 if (fGdpbIdIndexMap.end() != fGdpbIdIndexMap.find(fuGdpbId)) {
2213 UInt_t uChip = mess.getGdpbGenChipId();
2214 UInt_t uChan = mess.getGdpbSlcChan();
2215 UInt_t uEdge = mess.getGdpbSlcEdge();
2216 UInt_t uData = mess.getGdpbSlcData();
2217 UInt_t uType = mess.getGdpbSlcType();
2218 Double_t dGdpbChId = fuGet4Id * fuNrOfChannelsPerGet4 + mess.getGdpbSlcChan() + 0.5 * mess.getGdpbSlcEdge();
2219 Double_t dFullChId = fuGet4Nr * fuNrOfChannelsPerGet4 + mess.getGdpbSlcChan() + 0.5 * mess.getGdpbSlcEdge();
2220 Double_t dMessTime = static_cast<Double_t>(fulCurrentEpochTime) * 1.e-9;
2221
2222 switch (uType) {
2223 case 0: // Scaler counter
2224 {
2225 fhGet4ChanScm->Fill(dFullChId, uType);
2226 fvhGdpbGet4ChanScm[fuGdpbNr]->Fill(dGdpbChId, uType);
2227 fhScmScalerCounters->Fill(uData, dFullChId);
2228 break;
2229 }
2230 case 1: // Deadtime counter
2231 {
2232 fhGet4ChanScm->Fill(dFullChId, uType);
2233 fvhGdpbGet4ChanScm[fuGdpbNr]->Fill(dGdpbChId, uType);
2234 fhScmDeadtimeCounters->Fill(uData, dFullChId);
2235 break;
2236 }
2237 case 2: // SPI message
2238 {
2239 /*
2240 LOG(info) << "GET4 Slow Control message, epoch "
2241 << static_cast<Int_t>(fvulCurrentEpoch[fuGet4Nr]) << ", time " << std::setprecision(9)
2242 << std::fixed << dMessTime << " s "
2243 << " for board ID " << std::hex << std::setw(4) << fuGdpbId
2244 << std::dec << "\n"
2245 << " +++++++ > Chip = "
2246 << std::setw(2) << uChip << ", Chan = "
2247 << std::setw(1) << uChan << ", Edge = "
2248 << std::setw(1) << uEdge << ", Type = "
2249 << std::setw(1) << mess.getGdpbSlcType() << ", Data = 0x"
2250// << std::hex << std::setw(6) << mess.getGdpbSlcData()
2251 << Form( "%06x", uData )
2252 << std::dec << ", CRC = " << uCRC
2253// << " RAW: " << Form( "%08x", mess.getGdpbSlcMess() );
2254*/
2255 fhGet4ChanScm->Fill(dFullChId, uType);
2256 fvhGdpbGet4ChanScm[fuGdpbNr]->Fill(dGdpbChId, uType);
2257 break;
2258 }
2259 case 3: // Start message or SEU counter
2260 {
2261 if (0 == mess.getGdpbSlcChan() && 0 == mess.getGdpbSlcEdge()) // START message
2262 {
2263 /*
2264 LOG(info) << std::setprecision(9)
2265 << std::fixed << dMessTime << " s ";
2266 LOG(info) << "GET4 Slow Control message, epoch "
2267 << static_cast<Int_t>(fvulCurrentEpoch[fuGet4Nr]) << ", time " << std::setprecision(9)
2268 << std::fixed << dMessTime << " s "
2269 << " for board ID " << std::hex << std::setw(4) << fuGdpbId
2270 << std::dec << "\n"
2271 << " +++++++ > Chip = "
2272 << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = "
2273 << std::setw(1) << mess.getGdpbSlcChan() << ", Edge = "
2274 << std::setw(1) << mess.getGdpbSlcEdge() << ", Type = "
2275 << std::setw(1) << mess.getGdpbSlcType() << ", Data = 0x"
2276 // << std::hex << std::setw(6) << mess.getGdpbSlcData()
2277 << Form( "%06x", mess.getGdpbSlcData() )
2278 << std::dec << ", CRC = " << mess.getGdpbSlcCrc();
2279*/
2280 fhGet4ChanScm->Fill(dFullChId, uType + 1);
2281 fvhGdpbGet4ChanScm[fuGdpbNr]->Fill(dGdpbChId, uType + 1);
2282 } // if( 0 == mess.getGdpbSlcChan() && 0 == mess.getGdpbSlcEdge() )
2283 else if (0 == mess.getGdpbSlcChan() && 1 == mess.getGdpbSlcEdge()) // SEU counter message
2284 {
2285 /*
2286 LOG(info) << "GET4 Slow Control message, epoch "
2287 << static_cast<Int_t>(fvulCurrentEpoch[fuGet4Nr]) << ", time " << std::setprecision(9)
2288 << std::fixed << dMessTime << " s "
2289 << " for board ID " << std::hex << std::setw(4) << fuGdpbId
2290 << std::dec << "\n"
2291 << " +++++++ > Chip = "
2292 << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = "
2293 << std::setw(1) << mess.getGdpbSlcChan() << ", Edge = "
2294 << std::setw(1) << mess.getGdpbSlcEdge() << ", Type = "
2295 << std::setw(1) << mess.getGdpbSlcType() << ", Data = 0x"
2296// << std::hex << std::setw(6) << mess.getGdpbSlcData()
2297 << Form( "%06x", mess.getGdpbSlcData() )
2298 << std::dec << ", CRC = " << mess.getGdpbSlcCrc();
2299*/
2300 fhGet4ChanScm->Fill(dFullChId, uType);
2301 fvhGdpbGet4ChanScm[fuGdpbNr]->Fill(dGdpbChId, uType);
2302 fhScmSeuCounters->Fill(uData, dFullChId);
2303 fhScmSeuCountersEvo->Fill(dMessTime - fdStartTime * 1.e-9, uData, dFullChId);
2304 } // else if( 0 == mess.getGdpbSlcChan() && 1 == mess.getGdpbSlcEdge() )
2305 break;
2306 }
2307 default: // Should never happen
2308 break;
2309 } // switch( mess.getGdpbSlcType() )
2310 }
2311}
2312
2314{
2315 Int_t mType = mess.getMessageType();
2316 Int_t channel = mess.getGdpbHitChanId();
2317 uint64_t uData = mess.getData();
2318
2319 LOG(debug) << "Get4 MSG type " << mType << " from gdpbId " << fuGdpbId << ", getId " << fuGet4Id << ", (hit channel) "
2320 << channel << " data " << std::hex << uData;
2321}
2322
2324{
2325 if (fGdpbIdIndexMap.end() != fGdpbIdIndexMap.find(fuGdpbId))
2326 LOG(debug) << "GET4 System message, epoch " << static_cast<Int_t>(fvulCurrentEpoch[fuGet4Nr]) << ", time "
2327 << std::setprecision(9) << std::fixed << Double_t(fulCurrentEpochTime) * 1.e-9 << " s "
2328 << " for board ID " << std::hex << std::setw(4) << fuGdpbId << std::dec;
2329
2330 switch (mess.getGdpbSysSubType()) {
2332 uint32_t uData = mess.getGdpbSysErrData();
2336 LOG(debug) << " +++++++ > gDPB: " << std::hex << std::setw(4) << fuGdpbId << std::dec
2337 << ", Chip = " << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
2338 << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1) << mess.getGdpbSysErrEdge()
2339 << ", Empt = " << std::setw(1) << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
2340 << std::setw(2) << uData << std::dec << " -- GET4 V1 Error Event";
2341 else
2342 LOG(debug) << " +++++++ >gDPB: " << std::hex << std::setw(4) << fuGdpbId << std::dec
2343 << ", Chip = " << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
2344 << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1) << mess.getGdpbSysErrEdge()
2345 << ", Empt = " << std::setw(1) << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
2346 << std::setw(2) << uData << std::dec << " -- GET4 V1 Error Event ";
2347 break;
2348 } // case gdpbv100::SYSMSG_GET4_EVENT
2350 LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.getGdpbSysUnkwData() << std::dec
2351 << " Full message: " << std::hex << std::setw(16) << mess.getData() << std::dec;
2352 break;
2353 } // case gdpbv100::SYS_GDPB_UNKWN:
2355 LOG(debug) << "GET4 synchronization pulse missing";
2356 break;
2357 } // case gdpbv100::SYS_GET4_SYNC_MISS:
2358 case gdpbv100::SYS_PATTERN: {
2359 LOG(debug) << "ASIC pattern for missmatch, disable or resync";
2360 break;
2361 } // case gdpbv100::SYS_PATTERN:
2362 default: {
2363 LOG(debug) << "Crazy system message, subtype " << mess.getGdpbSysSubType();
2364 break;
2365 } // default
2366
2367 } // switch( getGdpbSysSubType() )
2368}
2369
2371{
2372 uint16_t usType = mess.getGdpbSysPattType();
2373 uint16_t usIndex = mess.getGdpbSysPattIndex();
2374 uint32_t uPattern = mess.getGdpbSysPattPattern();
2375
2376 switch (usType) {
2378 LOG(debug) << Form("Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern);
2379 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2380 if ((uPattern >> uBit) & 0x1) {
2381 UInt_t uBadAsic = ConvertElinkToGet4(32 * usIndex + uBit);
2383 if (fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2384 fhPatternMissmatch->Fill(uBadAsic, fuGdpbNr);
2386 } // if( ( uPattern >> uBit ) & 0x1 )
2387
2388 break;
2389 } // case gdpbv100::PATT_MISSMATCH:
2390 case gdpbv100::PATT_ENABLE: {
2391 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2392 if ((uPattern >> uBit) & 0x1) {
2393 UInt_t uBadAsic = ConvertElinkToGet4(32 * usIndex + uBit);
2395 if (fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2396 fhPatternEnable->Fill(uBadAsic, fuGdpbNr);
2398 } // if( ( uPattern >> uBit ) & 0x1 )
2399
2400 break;
2401 } // case gdpbv100::PATT_ENABLE:
2402 case gdpbv100::PATT_RESYNC: {
2403 LOG(debug) << Form("RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern);
2404
2405 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2406 if ((uPattern >> uBit) & 0x1) {
2407 UInt_t uBadAsic = ConvertElinkToGet4(32 * usIndex + uBit);
2409 if (fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2410 fhPatternResync->Fill(uBadAsic, fuGdpbNr);
2412 } // if( ( uPattern >> uBit ) & 0x1 )
2413
2414 break;
2415 } // case gdpbv100::PATT_RESYNC:
2416 default: {
2417 LOG(debug) << "Crazy pattern message, subtype " << usType;
2418 break;
2419 } // default
2420 } // switch( usType )
2421
2422 return;
2423}
2424
2426{
2427 Int_t iMsgIndex = mess.getStarTrigMsgIndex();
2428
2429 switch (iMsgIndex) {
2430 case 0:
2431 fvhTokenMsgType[fuGdpbNr]->Fill(0);
2433 break;
2434 case 1:
2435 fvhTokenMsgType[fuGdpbNr]->Fill(1);
2438 break;
2439 case 2:
2440 fvhTokenMsgType[fuGdpbNr]->Fill(2);
2442 break;
2443 case 3: {
2444 fvhTokenMsgType[fuGdpbNr]->Fill(3);
2445
2446 ULong64_t ulNewGdpbTsFull = (fvulGdpbTsMsb[fuGdpbNr] << 24) + (fvulGdpbTsLsb[fuGdpbNr]);
2447 ULong64_t ulNewStarTsFull =
2449 UInt_t uNewToken = mess.getStarTokenStarD();
2450 UInt_t uNewDaqCmd = mess.getStarDaqCmdStarD();
2451 UInt_t uNewTrigCmd = mess.getStarTrigCmdStarD();
2452
2453 if ((uNewToken == fvuStarTokenLast[fuGdpbNr]) && (ulNewGdpbTsFull == fvulGdpbTsFullLast[fuGdpbNr])
2454 && (ulNewStarTsFull == fvulStarTsFullLast[fuGdpbNr]) && (uNewDaqCmd == fvuStarDaqCmdLast[fuGdpbNr])
2455 && (uNewTrigCmd == fvuStarTrigCmdLast[fuGdpbNr])) {
2456 UInt_t uTrigWord = ((fvuStarTrigCmdLast[fuGdpbNr] & 0x00F) << 16)
2457 + ((fvuStarDaqCmdLast[fuGdpbNr] & 0x00F) << 12) + ((fvuStarTokenLast[fuGdpbNr] & 0xFFF));
2458 LOG(warning) << "Possible error: identical STAR tokens found twice in "
2459 "a row => ignore 2nd! "
2460 << " TS " << fulCurrentTsIndex << " gDBB #" << fuGdpbNr << " "
2461 << Form("token = %5u ", fvuStarTokenLast[fuGdpbNr])
2462 << Form("gDPB ts = %12llu ", fvulGdpbTsFullLast[fuGdpbNr])
2463 << Form("STAR ts = %12llu ", fvulStarTsFullLast[fuGdpbNr])
2464 << Form("DAQ cmd = %2u ", fvuStarDaqCmdLast[fuGdpbNr])
2465 << Form("TRG cmd = %2u ", fvuStarTrigCmdLast[fuGdpbNr]) << Form("TRG Wrd = %5x ", uTrigWord);
2466 return;
2467 } // if exactly same message repeated
2468 /*
2469 if( (uNewToken != fuStarTokenLast[fuGdpbNr] + 1) &&
2470 0 < fvulGdpbTsFullLast[fuGdpbNr] && 0 < fvulStarTsFullLast[fuGdpbNr] &&
2471 ( 4095 != fvuStarTokenLast[fuGdpbNr] || 1 != uNewToken) )
2472 LOG(warning) << "Possible error: STAR token did not increase by exactly 1! "
2473 << " gDBB #" << fuGdpbNr << " "
2474 << Form("old = %5u vs new = %5u ", fvuStarTokenLast[fuGdpbNr], uNewToken)
2475 << Form("old = %12llu vs new = %12llu ", fvulGdpbTsFullLast[fuGdpbNr], ulNewGdpbTsFull)
2476 << Form("old = %12llu vs new = %12llu ", fvulStarTsFullLast[fuGdpbNr], ulNewStarTsFull)
2477 << Form("old = %2u vs new = %2u ", fvuStarDaqCmdLast[fuGdpbNr], uNewDaqCmd)
2478 << Form("old = %2u vs new = %2u ", fvuStarTrigCmdLast[fuGdpbNr], uNewTrigCmd);
2479*/
2480 // STAR TS counter reset detection
2481 if (ulNewStarTsFull < fvulStarTsFullLast[fuGdpbNr])
2482 LOG(debug) << "Probable reset of the STAR TS: old = " << Form("%16llu", fvulStarTsFullLast[fuGdpbNr])
2483 << " new = " << Form("%16llu", ulNewStarTsFull) << " Diff = -"
2484 << Form("%8llu", fvulStarTsFullLast[fuGdpbNr] - ulNewStarTsFull);
2485
2486 /*
2487 LOG(info) << "Updating trigger token for " << fuGdpbNr
2488 << " " << fuStarTokenLast[fuGdpbNr] << " " << uNewToken;
2489*/
2490 ULong64_t ulGdpbTsDiff = ulNewGdpbTsFull - fvulGdpbTsFullLast[fuGdpbNr];
2491 fvulGdpbTsFullLast[fuGdpbNr] = ulNewGdpbTsFull;
2492 fvulStarTsFullLast[fuGdpbNr] = ulNewStarTsFull;
2493 fvuStarTokenLast[fuGdpbNr] = uNewToken;
2494 fvuStarDaqCmdLast[fuGdpbNr] = uNewDaqCmd;
2495 fvuStarTrigCmdLast[fuGdpbNr] = uNewTrigCmd;
2496
2498 if (fuCurrentMs < fuCoreMs) {
2500 if (0 <= fdStartTime) {
2505 } // if( fuHistoryHistoSize < 1e-9 * (fulGdpbTsFullLast * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
2506
2507 fvhTriggerRate[fuGdpbNr]->Fill(1e-9
2518 } // if( 0 < fdStartTime )
2519 else
2522 } // if( fuCurrentMs < fuCoreMs )
2523
2524 break;
2525 } // case 3
2526 default: LOG(error) << "Unknown Star Trigger messageindex: " << iMsgIndex;
2527 } // switch( iMsgIndex )
2528}
2529
2531
2533{
2534 // Printout some stats on what was unpacked
2535 TString message_type;
2536 for (unsigned int i = 0; i < fviMsgCounter.size(); ++i) {
2537 switch (i) {
2538 case 0: message_type = "NOP"; break;
2539 case 1: message_type = "HIT"; break;
2540 case 2: message_type = "EPOCH"; break;
2541 case 3: message_type = "SYNC"; break;
2542 case 4: message_type = "AUX"; break;
2543 case 5: message_type = "EPOCH2"; break;
2544 case 6: message_type = "GET4"; break;
2545 case 7: message_type = "SYS"; break;
2546 case 8: message_type = "GET4_SLC"; break;
2547 case 9: message_type = "GET4_32B"; break;
2548 case 10: message_type = "GET4_SYS"; break;
2549 default: message_type = "UNKNOWN"; break;
2550 } // switch(i)
2551 LOG(info) << message_type << " messages: " << fviMsgCounter[i];
2552 } // for (unsigned int i=0; i< fviMsgCounter.size(); ++i)
2553
2554 LOG(info) << "-------------------------------------";
2555 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
2556 for (UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j) {
2557 LOG(info) << "Last epoch for gDPB: " << std::hex << std::setw(4) << i << std::dec << " , GET4 " << std::setw(4)
2558 << j << " => " << fvulCurrentEpoch[GetArrayIndex(i, j)];
2559 } // for (UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j)
2560 } // for (UInt_t i = 0; i < fuNrOfGdpbs; ++i)
2561 LOG(info) << "-------------------------------------";
2562
2563
2565 if (kTRUE == fbPulserModeEnable) {
2567 fhTimeMeanPulser->Reset();
2568 fhTimeRmsPulser->Reset();
2569
2570 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
2571 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
2572 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) {
2573 fhTimeMeanPulser->Fill(uFeeA, uFeeB, fvhTimeDiffPulser[uFeeA][uFeeB]->GetMean());
2574 fhTimeRmsPulser->Fill(uFeeA, uFeeB, fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS());
2575 } // for( UInt_t uChan = 0; uChan < kuNbChanTest - 1; uChan++)
2576
2579 } // if( kTRUE == fbPulserModeEnable )
2580
2581 SaveAllHistos();
2582}
2583
2585{
2586 TDirectory* oldDir = NULL;
2587 TFile* histoFile = NULL;
2588 if ("" != sFileName) {
2589 // Store current directory position to allow restore later
2590 oldDir = gDirectory;
2591 // open separate histo file in recreate mode
2592 histoFile = new TFile(sFileName, "RECREATE");
2593 histoFile->cd();
2594 } // if( "" != sFileName )
2595
2596 gDirectory->mkdir("Tof_Raw_gDPB");
2597 gDirectory->cd("Tof_Raw_gDPB");
2598
2599 fhMessType->Write();
2600 fhSysMessType->Write();
2601 fhGet4MessType->Write();
2602 fhGet4ChanScm->Write();
2603 fhGet4ChanErrors->Write();
2604 fhGet4EpochFlags->Write();
2605
2606 fhGdpbMessType->Write();
2607 fhGdpbSysMessType->Write();
2608 fhGdpbSysMessPattType->Write();
2609 fhGdpbEpochFlags->Write();
2610 fhGdpbEpochSyncEvo->Write();
2611 fhGdpbEpochMissEvo->Write();
2612
2613 fhScmScalerCounters->Write();
2614 fhScmDeadtimeCounters->Write();
2615 fhScmSeuCounters->Write();
2616 fhScmSeuCountersEvo->Write();
2617
2618 fhPatternMissmatch->Write();
2619 fhPatternEnable->Write();
2620 fhPatternResync->Write();
2621
2622 for (UInt_t uTotPlot = 0; uTotPlot < fvhRawTot_gDPB.size(); ++uTotPlot)
2623 fvhRawTot_gDPB[uTotPlot]->Write();
2624
2625 for (UInt_t uTotPlot = 0; uTotPlot < fvhRemapTot_gDPB.size(); ++uTotPlot)
2626 fvhRemapTot_gDPB[uTotPlot]->Write();
2627
2628 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
2629 fvhRemapTotSideA_mod[uMod]->Write();
2630 fvhRemapTotSideB_mod[uMod]->Write();
2631
2632 fvhModRate[uMod]->Write();
2633 fvhModErrorRate[uMod]->Write();
2634 fvhModErrorRatio[uMod]->Write();
2635 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
2636
2637 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2638 fvhGdpbGet4MessType[uGdpb]->Write();
2639 fvhGdpbGet4ChanScm[uGdpb]->Write();
2640 fvhGdpbGet4ChanErrors[uGdpb]->Write();
2641
2642 fvhGdpbPatternMissmatchEvo[uGdpb]->Write();
2643 fvhGdpbPatternEnableEvo[uGdpb]->Write();
2644 fvhGdpbPatternResyncEvo[uGdpb]->Write();
2645
2646 fvhRawFt_gDPB[uGdpb]->Write();
2647 fvhChCount_gDPB[uGdpb]->Write();
2648 fvhChannelRate_gDPB[uGdpb]->Write();
2649 fvhRemapChCount_gDPB[uGdpb]->Write();
2650 fvhRemapChRate_gDPB[uGdpb]->Write();
2651
2652 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
2653 fvhFeeRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2654 fvhFeeErrorRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2655 fvhFeeErrorRatio_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2656 fvhFeeRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2657 fvhFeeErrorRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2658 fvhFeeErrorRatioLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Write();
2659 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++ uFee)
2660
2661 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2662 if (kTRUE == fbPulserModeEnable) {
2663 fhTimeMeanPulser->Write();
2664 fhTimeRmsPulser->Write();
2665 fhTimeRmsZoomFitPuls->Write();
2666 fhTimeResFitPuls->Write();
2667 } // if( kTRUE == fbPulserModeEnable )
2668 gDirectory->cd("..");
2669
2671 gDirectory->mkdir("Star_Raw");
2672 gDirectory->cd("Star_Raw");
2673 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2674 fvhTokenMsgType[uGdpb]->Write();
2675 fvhTriggerRate[uGdpb]->Write();
2676 fvhCmdDaqVsTrig[uGdpb]->Write();
2677 fvhStarTokenEvo[uGdpb]->Write();
2678 fvhStarTrigGdpbTsEvo[uGdpb]->Write();
2679 fvhStarTrigStarTsEvo[uGdpb]->Write();
2680 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2681 gDirectory->cd("..");
2682
2684 if (kTRUE == fbPulserModeEnable) {
2685 gDirectory->mkdir("TofDt");
2686 gDirectory->cd("TofDt");
2687 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
2688 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
2689 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) fvhTimeDiffPulser[uFeeA][uFeeB]->Write();
2690 gDirectory->cd("..");
2691
2693 gDirectory->mkdir("TofDtEvo");
2694 gDirectory->cd("TofDtEvo");
2695 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2696 for (UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx)
2697 fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx]->Write();
2698
2699 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB < fuNrOfGdpbs; ++uGdpbB)
2700 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpbB]->Write();
2701 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2702 gDirectory->cd("..");
2703 } // if( kTRUE == fbPulserModeEnable )
2704
2706 if (kTRUE == fbCoincMapsEnable) {
2707 gDirectory->mkdir("TofCoinc");
2708 gDirectory->cd("TofCoinc");
2709 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2710 fvhCoincMapAllChanGdpb[uGdpb]->Write();
2711 fvhCoincMeanAllChanGdpb[uGdpb]->Write();
2712 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2713 gDirectory->cd("..");
2714 } // if( kTRUE == fbCoincMapsEnable )
2715
2716 gDirectory->mkdir("Flib_Raw");
2717 gDirectory->cd("Flib_Raw");
2718 for (UInt_t uLinks = 0; uLinks < fvhMsSzPerLink.size(); uLinks++) {
2719 if (NULL == fvhMsSzPerLink[uLinks]) continue;
2720
2721 fvhMsSzPerLink[uLinks]->Write();
2722 fvhMsSzTimePerLink[uLinks]->Write();
2723 } // for( UInt_t uLinks = 0; uLinks < fvhMsSzPerLink.size(); uLinks++ )
2724
2725 TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
2726 if (NULL != pMissedTsH1) pMissedTsH1->Write();
2727
2728 TProfile* pMissedTsEvoP = dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
2729 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
2730
2731 gDirectory->cd("..");
2732
2733
2734 if ("" != sFileName) {
2735 // Restore original directory position
2736 histoFile->Close();
2737 oldDir->cd();
2738 } // if( "" != sFileName )
2739 if ("" != sFileName) {
2740 // Restore original directory position
2741 histoFile->Close();
2742 oldDir->cd();
2743 } // if( "" != sFileName )
2744}
2745
2747{
2748 LOG(info) << "Reseting all TOF histograms.";
2749
2750 fhMessType->Reset();
2751 fhSysMessType->Reset();
2752 fhGet4MessType->Reset();
2753 fhGet4ChanScm->Reset();
2754 fhGet4ChanErrors->Reset();
2755 fhGet4EpochFlags->Reset();
2756
2757 fhGdpbMessType->Reset();
2758 fhGdpbSysMessType->Reset();
2759 fhGdpbSysMessPattType->Reset();
2760 fhGdpbEpochFlags->Reset();
2761 fhGdpbEpochSyncEvo->Reset();
2762 fhGdpbEpochMissEvo->Reset();
2763
2764 fhScmScalerCounters->Reset();
2765 fhScmDeadtimeCounters->Reset();
2766 fhScmSeuCounters->Reset();
2767 fhScmSeuCountersEvo->Reset();
2768
2769 fhPatternMissmatch->Reset();
2770 fhPatternEnable->Reset();
2771 fhPatternResync->Reset();
2772
2773 for (UInt_t uTotPlot = 0; uTotPlot < fvhRawTot_gDPB.size(); ++uTotPlot)
2774 fvhRawTot_gDPB[uTotPlot]->Reset();
2775
2776 for (UInt_t uTotPlot = 0; uTotPlot < fvhRemapTot_gDPB.size(); ++uTotPlot)
2777 fvhRemapTot_gDPB[uTotPlot]->Reset();
2778
2779 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
2780 fvhRemapTotSideA_mod[uMod]->Reset();
2781 fvhRemapTotSideB_mod[uMod]->Reset();
2782
2783 fvhModRate[uMod]->Reset();
2784 fvhModErrorRate[uMod]->Reset();
2785 fvhModErrorRatio[uMod]->Reset();
2786 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
2787
2788 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2789 fvhGdpbGet4MessType[uGdpb]->Reset();
2790 fvhGdpbGet4ChanScm[uGdpb]->Reset();
2791 fvhGdpbGet4ChanErrors[uGdpb]->Reset();
2792
2793 fvhGdpbPatternMissmatchEvo[uGdpb]->Reset();
2794 fvhGdpbPatternEnableEvo[uGdpb]->Reset();
2795 fvhGdpbPatternResyncEvo[uGdpb]->Reset();
2796
2797 fvhRawFt_gDPB[uGdpb]->Reset();
2798 fvhChCount_gDPB[uGdpb]->Reset();
2799 fvhChannelRate_gDPB[uGdpb]->Reset();
2800 fvhRemapChCount_gDPB[uGdpb]->Reset();
2801 fvhRemapChRate_gDPB[uGdpb]->Reset();
2802
2803 for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++uFee) {
2804 fvhFeeRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2805 fvhFeeErrorRate_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2806 fvhFeeErrorRatio_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2807 fvhFeeRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2808 fvhFeeErrorRateLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2809 fvhFeeErrorRatioLong_gDPB[uGdpb * fuNrOfFeePerGdpb + uFee]->Reset();
2810 } // for (UInt_t uFee = 0; uFee < fuNrOfFeePerGdpb; ++ uFee)
2811
2812 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2813
2815 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2816 fvhTokenMsgType[uGdpb]->Reset();
2817 fvhTriggerRate[uGdpb]->Reset();
2818 fvhCmdDaqVsTrig[uGdpb]->Reset();
2819 fvhStarTokenEvo[uGdpb]->Reset();
2820 fvhStarTrigGdpbTsEvo[uGdpb]->Reset();
2821 fvhStarTrigStarTsEvo[uGdpb]->Reset();
2822 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2823
2825 if (kTRUE == fbPulserModeEnable) {
2826 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
2827 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
2828 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) fvhTimeDiffPulser[uFeeA][uFeeB]->Reset();
2829
2830 fhTimeMeanPulser->Reset();
2831 fhTimeRmsPulser->Reset();
2832 fhTimeRmsZoomFitPuls->Reset();
2833 fhTimeResFitPuls->Reset();
2834
2835 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2836 for (UInt_t uGbtx = 0; uGbtx < kuNbGbtxPerGdpb - 1; ++uGbtx)
2837 fvhPulserTimeDiffEvoGbtxGbtx[uGdpb * (kuNbGbtxPerGdpb - 1) + uGbtx]->Reset();
2838
2839 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB < fuNrOfGdpbs; ++uGdpbB)
2840 fvvhPulserTimeDiffEvoGdpbGdpb[uGdpb][uGdpbB]->Reset();
2841 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2842 } // if( kTRUE == fbPulserModeEnable )
2843
2845 if (kTRUE == fbCoincMapsEnable) {
2846 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2847 fvhCoincMapAllChanGdpb[uGdpb]->Reset();
2848 fvhCoincMeanAllChanGdpb[uGdpb]->Reset();
2849 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2850 } // if( kTRUE == fbCoincMapsEnable )
2851
2852 for (UInt_t uLinks = 0; uLinks < fvhMsSzPerLink.size(); uLinks++) {
2853 if (NULL == fvhMsSzPerLink[uLinks]) continue;
2854
2855 fvhMsSzPerLink[uLinks]->Reset();
2856 fvhMsSzTimePerLink[uLinks]->Reset();
2857 } // for( UInt_t uLinks = 0; uLinks < fvhMsSzPerLink.size(); uLinks++ )
2858
2859 fdStartTime = -1;
2860 fdStartTimeLong = -1;
2861 fdStartTimeMsSz = -1;
2862}
2864{
2865 for (UInt_t uGdpbLoop = 0; uGdpbLoop < fuNrOfGdpbs; ++uGdpbLoop) {
2866 fvhChannelRate_gDPB[uGdpbLoop]->Reset();
2867 fvhRemapChRate_gDPB[uGdpbLoop]->Reset();
2868 for (UInt_t uFeeLoop = 0; uFeeLoop < fuNrOfFeePerGdpb; ++uFeeLoop) {
2869 fvhFeeRate_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2870 fvhFeeErrorRate_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2871 fvhFeeErrorRatio_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2872 } // for( UInt_t uFeeLoop = 0; uFeeLoop < fuNrOfFeePerGdpb; ++uFeeLoop )
2873 fvhTriggerRate[uGdpbLoop]->Reset();
2874 fvhStarTokenEvo[uGdpbLoop]->Reset();
2875 fvhStarTrigGdpbTsEvo[uGdpbLoop]->Reset();
2876 fvhStarTrigStarTsEvo[uGdpbLoop]->Reset();
2877 } // for( UInt_t uGdpbLoop = 0; uGdpbLoop < fuNrOfGdpbs; ++uGdpbLoop )
2878
2879 for (UInt_t uMod = 0; uMod < fuNrOfModules; uMod++) {
2880 fvhModRate[uMod]->Reset();
2881 fvhModErrorRate[uMod]->Reset();
2882 fvhModErrorRatio[uMod]->Reset();
2883 } // for( UInt_t uMod = 0; uMod < fuNrOfModules; uMod ++ )
2884
2885 fdStartTime = -1;
2886}
2888{
2889 for (UInt_t uGdpbLoop = 0; uGdpbLoop < fuNrOfGdpbs; uGdpbLoop++) {
2890 for (UInt_t uFeeLoop = 0; uFeeLoop < fuNrOfFeePerGdpb; uFeeLoop++) {
2891 fvhFeeRateLong_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2892 fvhFeeErrorRateLong_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2893 fvhFeeErrorRatioLong_gDPB[(uGdpbLoop * fuNrOfFeePerGdpb) + uFeeLoop]->Reset();
2894 } // for (UInt_t uFeeLoop = 0; uFeeLoop < fuNrOfFeePerGdpb; uFeeLoop++)
2895 } // for (UInt_t uFeeLoop = 0; uFeeLoop < fuNrOfFeePerGdpb; uFeeLoop++)
2896
2897 fdStartTimeLong = -1;
2898}
2899
2901{
2902 if (kFALSE == fbPulserModeEnable) {
2903 LOG(error) << "CbmStar2019MonitorTof::UpdateZoomedFit => "
2904 << "Pulser mode not enabled in root macro, doinb nothing !!! ";
2905 return;
2906 } // if( kFALSE == fbPulserModeEnable )
2907
2908 // Only do something is the user defined the width he want for the zoom
2909 if (0.0 < fdFitZoomWidthPs) {
2910 // Reset summary histograms for safety
2911 fhTimeRmsZoomFitPuls->Reset();
2912 fhTimeResFitPuls->Reset();
2913
2914 Double_t dRes = 0;
2916
2917 for (UInt_t uFeeA = 0; uFeeA < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeA++)
2918 for (UInt_t uFeeB = 0; uFeeB < fuNrOfFeePerGdpb * fuNrOfGdpbs; uFeeB++)
2919 if (NULL != fvhTimeDiffPulser[uFeeA][uFeeB]) {
2920 // Check that we have at least 1 entry
2921 if (0 == fvhTimeDiffPulser[uFeeA][uFeeB]->GetEntries()) {
2922 fhTimeRmsZoomFitPuls->Fill(uFeeA, uFeeB, 0.0);
2923 fhTimeResFitPuls->Fill(uFeeA, uFeeB, 0.0);
2924 LOG(info) << "CbmStar2019MonitorTof::UpdateZoomedFit => Empty input "
2925 << "for FEE pair " << uFeeA << " and " << uFeeB << " !!! ";
2926 continue;
2927 } // if( 0 == fvhTimeDiffPulser[uFeeA][uFeeB]->GetEntries() )
2928
2929 // Read the peak position (bin with max counts) + total nb of entries
2930 Int_t iBinWithMax = fvhTimeDiffPulser[uFeeA][uFeeB]->GetMaximumBin();
2931 Double_t dNbCounts = fvhTimeDiffPulser[uFeeA][uFeeB]->Integral();
2932
2933 // Zoom the X axis to +/- ZoomWidth around the peak position
2934 Double_t dPeakPos = fvhTimeDiffPulser[uFeeA][uFeeB]->GetXaxis()->GetBinCenter(iBinWithMax);
2935 fvhTimeDiffPulser[uFeeA][uFeeB]->GetXaxis()->SetRangeUser(dPeakPos - fdFitZoomWidthPs,
2936 dPeakPos + fdFitZoomWidthPs);
2937
2938 // Read integral and check how much we lost due to the zoom (% loss allowed)
2939 Double_t dZoomCounts = fvhTimeDiffPulser[uFeeA][uFeeB]->Integral();
2940 if ((dZoomCounts / dNbCounts) < 0.99) {
2941 fhTimeRmsZoomFitPuls->Fill(uFeeA, uFeeB, 0.0);
2942 fhTimeResFitPuls->Fill(uFeeA, uFeeB, 0.0);
2943 LOG(warning) << "CbmStar2019MonitorTof::UpdateZoomedFit => Zoom too strong, "
2944 << "more than 1% loss for FEE pair " << uFeeA << " and " << uFeeB << " !!! ";
2945 continue;
2946 } // if( ( dZoomCounts / dNbCounts ) < 0.99 )
2947
2948 // Fill new RMS after zoom into summary histo
2949 fhTimeRmsZoomFitPuls->Fill(uFeeA, uFeeB, fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS());
2950
2951
2952 // Fit using zoomed boundaries + starting gaussian width, store into summary histo
2953 dRes = 0;
2954 fitFuncPairs[uFeeA][uFeeB] = new TF1(Form("fPair_%02d_%02d", uFeeA, uFeeB), "gaus",
2955 dPeakPos - fdFitZoomWidthPs, dPeakPos + fdFitZoomWidthPs);
2956 // Fix the Mean fit value around the Histogram Mean
2957 fitFuncPairs[uFeeA][uFeeB]->SetParameter(0, dZoomCounts);
2958 fitFuncPairs[uFeeA][uFeeB]->SetParameter(1, dPeakPos);
2959 fitFuncPairs[uFeeA][uFeeB]->SetParameter(2, 200.0); // Hardcode start with ~4*BinWidth, do better later
2960 // Using integral instead of bin center seems to lead to unrealistic values => no "I"
2961 fvhTimeDiffPulser[uFeeA][uFeeB]->Fit(Form("fPair_%02d_%02d", uFeeA, uFeeB), "QRM0");
2962 // Get Sigma
2963 dRes = fitFuncPairs[uFeeA][uFeeB]->GetParameter(2);
2964 // Cleanup memory
2965 delete fitFuncPairs[uFeeA][uFeeB];
2966 // Fill summary
2967 fhTimeResFitPuls->Fill(uFeeA, uFeeB, dRes / TMath::Sqrt2());
2968
2969
2970 LOG(info) << "CbmStar2019MonitorTof::UpdateZoomedFit => "
2971 << "For FEE pair " << uFeeA << " and " << uFeeB
2972 << " we have zoomed RMS = " << fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS() << " and a resolution of "
2973 << dRes / TMath::Sqrt2();
2974
2975 // Restore original axis state?
2976 fvhTimeDiffPulser[uFeeA][uFeeB]->GetXaxis()->UnZoom();
2977 } // loop on uFeeA and uFeeB + check if corresponding fvhTimeDiffPulser exists
2978 } // if( 0.0 < fdFitZoomWidthPs )
2979 else {
2980 LOG(error) << "CbmStar2019MonitorTof::UpdateZoomedFit => Zoom width not defined, "
2981 << "please use SetFitZoomWidthPs, e.g. in macro, before trying this "
2982 "update !!!";
2983 } // else of if( 0.0 < fdFitZoomWidthPs )
2984}
2985
ClassImp(CbmConverterManager)
Histogram manager.
Bool_t bMcbmMoniTofPrintAllEpochsEna
Bool_t bMcbmMoniTofSaveHistos
Bool_t bMcbmMoniTofResetHistos
Bool_t bMcbmMoniTofUpdateZoomedFit
Bool_t bMcbmMoniTofRawDataPrint
Bool_t bMcbmMoniTofPrintAllHitsEna
Bool_t bMcbmMoniTofPrintAllEpochsEna
Bool_t bMcbmMoniTofSaveHistos
Bool_t bMcbmMoniTofResetHistos
Bool_t bMcbmMoniTofUpdateZoomedFit
Bool_t bMcbmMoniTofRawDataPrint
Bool_t bMcbmMoniTofPrintAllHitsEna
static double dTsStartTime
static constexpr size_t size()
Definition KfSimdPseudo.h:2
void FillStarTrigInfo(gdpbv100::Message)
std::vector< ULong64_t > fvulStarTsMsb
std::vector< TH2 * > fvhCmdDaqVsTrig
std::vector< UInt_t > fvuStarDaqCmdLast
std::vector< TH2 * > fvhStarTokenEvo
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< ULong64_t > fvulGdpbTsMsb
std::vector< TProfile * > fvhStarTrigStarTsEvo
std::vector< UInt_t > fvuStarTrigCmdLast
std::vector< ULong64_t > fvulGdpbTsLsb
std::vector< TH1 * > fvhTriggerRate
std::vector< UInt_t > fvuStarTokenLast
std::vector< TH1 * > fvhTokenMsgType
std::vector< ULong64_t > fvulStarTsMid
std::vector< TProfile * > fvhStarTrigGdpbTsEvo
std::vector< ULong64_t > fvulGdpbTsFullLast
std::vector< ULong64_t > fvulStarTsMsb
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
std::vector< TProfile * > fvhStarTrigGdpbTsEvo
std::vector< TProfile * > fvhStarTrigStarTsEvo
std::vector< UInt_t > fvuFeeNbHitsLastMs
Buffer for pulser channels.
std::vector< TH1 * > fvhFeeErrorRateLong_gDPB
std::vector< TH2 * > fvhGdpbGet4ChanScm
std::vector< Int_t > fviNrOfRpc
std::vector< ULong64_t > fvulStarTsMid
std::vector< TProfile2D * > fvhCoincMeanAllChanGdpb
void FillHitInfo(gdpbv100::Message)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void PrintSysInfo(gdpbv100::Message)
std::vector< TH1 * > fvhModRate
module plots
std::vector< TH2 * > fvhGdpbPatternEnableEvo
TH2 * fhGet4MessType
Per GET4 in system.
std::vector< TH2 * > fvhRawFt_gDPB
TODO: Channel rate plots!
std::vector< TH2 * > fvhCmdDaqVsTrig
void SaveAllHistos(TString sFileName="")
std::vector< TProfile * > fvhPulserTimeDiffEvoGbtxGbtx
std::vector< std::vector< TH1 * > > fvhTimeDiffPulser
std::vector< TProfile * > fvhFeeErrorRatioLong_gDPB
std::vector< Int_t > fviRpcSide
std::vector< Bool_t > fvbFirstEpochSeen
const UInt_t kuNbBinsDt
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
std::vector< TH2 * > fvhRawTot_gDPB
std::vector< std::vector< UInt_t > > fvuCoincNbHitsLastMs
[ fuFeeNr ]
std::vector< TH2 * > fvhGdpbGet4MessType
Per GET4 in gDPB.
void ProcessEpochCycle(uint64_t ulCycleData)
std::vector< TProfile * > fvhModErrorRatio
std::vector< TH2 * > fvhRemapChRate_gDPB
std::vector< ULong64_t > fvulCurrentEpochCycle
std::vector< TH2 * > fvhRemapTotSideB_mod
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
std::vector< UInt_t > fvuStarTrigCmdLast
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
void FillEpochInfo(gdpbv100::Message)
void FillPattInfo(gdpbv100::Message)
std::vector< TH1 * > fvhMsSzPerLink
static const UInt_t kuNbGet4PerGbtx
TH2 * fhScmScalerCounters
Slow control messages.
std::vector< std::vector< Double_t > > fvdCoincTsLastHit
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
void FillStarTrigInfo(gdpbv100::Message)
TH2 * fhPatternMissmatch
Pattern messages per gDPB.
std::vector< TH1 * > fvhTriggerRate
std::vector< TH1 * > fvhFeeRate_gDPB
std::vector< Double_t > fdTsLastPulserHit
[ fuFeeNr ]
std::vector< TH2 * > fvhStarTokenEvo
std::vector< TH2 * > fvhGdpbGet4ChanErrors
std::vector< Int_t > fviModuleId
std::vector< size_t > fvMsComponentsList
FLES containers.
std::vector< UInt_t > fvuStarDaqCmdLast
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
std::vector< TH2 * > fvhGdpbPatternMissmatchEvo
Per MS in gDPB.
std::vector< TH2 * > fvhChannelRate_gDPB
std::vector< UInt_t > fvuPadiToGet4
std::vector< TH2 * > fvhCoincMapAllChanGdpb
std::vector< TH2 * > fvhRemapTotSideA_mod
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
std::vector< TH1 * > fvhChCount_gDPB
std::vector< ULong64_t > fvulCurrentEpoch
std::vector< ULong64_t > fvulGdpbTsMsb
std::vector< ULong64_t > fvulGdpbTsLsb
std::vector< TH1 * > fvhModErrorRate
std::vector< ULong64_t > fvulGdpbTsFullLast
std::vector< UInt_t > fvuGet4ToPadi
std::vector< int > fviMsgCounter
void PrintGenInfo(gdpbv100::Message)
CbmStar2019TofPar * fUnpackPar
std::vector< UInt_t > fvuStarTokenLast
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
std::vector< TH1 * > fvhFeeErrorRate_gDPB
std::vector< TH1 * > fvhFeeRateLong_gDPB
void PrintSlcInfo(gdpbv100::Message)
std::vector< UInt_t > fvuGet4ToElink
std::vector< TProfile * > fvhMsSzTimePerLink
std::vector< Int_t > fviRpcType
std::vector< TH2 * > fvhGdpbPatternResyncEvo
std::vector< TH2 * > fvhRemapTot_gDPB
std::vector< TH1 * > fvhTokenMsgType
size_t fuMsAcceptsPercent
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoGdpbGdpb
std::vector< TH1 * > fvhRemapChCount_gDPB
std::vector< TProfile * > fvhFeeErrorRatio_gDPB
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Int_t GetRpcType(UInt_t uGbtx)
Int_t GetModuleId(UInt_t uGbtx)
Int_t GetNrOfRpc(UInt_t uGbtx)
Int_t GetGdpbId(Int_t i)
static constexpr UInt_t GetNrOfChannelsPerGet4()
static constexpr UInt_t GetNrOfGet4PerFee()
Int_t GetRpcSide(UInt_t uGbtx)
Data class with information on a STS local track.
uint16_t getGdpbHitIs24b() const
uint16_t getStarTrigMsgIndex() const
uint32_t getGdpbEpEpochNb() const
uint16_t getGdpbHit32Tot() const
uint16_t getGdpbSysPattType() const
uint64_t getStarTsMidStarC() const
uint16_t getGdpbSysSubType() const
uint64_t getGdpbTsLsbStarB() const
uint32_t getGdpbSlcChan() const
bool getGdpbEpMissmatch() const
double getMsgFullTimeD(uint64_t epoch) const
Returns expanded and adjusted time of message in double (in ns)
uint16_t getGdpbSysPattIndex() const
void setGdpbGenChipId(uint32_t v)
uint16_t getGdpbHitFineTs() const
uint32_t getGdpbSlcData() const
void setGdpbEpEpochNb(uint32_t v)
bool getGdpbEpSync() const
uint64_t getStarTsMsbStarB() const
uint32_t getGdpbHitFullTs() const
uint32_t getStarTrigCmdStarD() const
uint32_t getGdpbSysPattPattern() const
uint32_t getGdpbSlcType() const
bool isStarTrigger() const
Returns true is message type is MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message)
bool getGdpbEpEpochLoss() const
uint32_t getStarDaqCmdStarD() const
uint64_t getGdpbTsMsbStarA() const
uint16_t getGdpbGenChipId() const
uint16_t getGdpbSysErrUnused() const
void printDataCout(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to cout.
bool getGdpbEpDataLoss() const
uint32_t getStarTokenStarD() const
bool getGdpbEpLinkId() const
uint32_t getGdpbSlcEdge() const
uint64_t getStarTsLsbStarD() const
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
uint32_t getGdpbSysUnkwData() const
uint64_t getData() const
uint16_t getGdpbSysErrData() const
bool getGdpbSysErrEdge() const
uint16_t getGdpbSysErrChanId() const
uint64_t getMsgFullTime(uint64_t epoch) const
Returns expanded and adjusted time of message (in ns)
uint16_t getGdpbHitChanId() const
const double kdClockCycleSizeNs
@ GET4_V2X_ERR_LOST_EVT
@ GET4_V2X_ERR_TOT_RANGE
@ GET4_V2X_ERR_FIFO_WRITE
@ GET4_V2X_ERR_DLL_LOCK
@ GET4_V2X_ERR_EPOCH_OVERF
@ GET4_V2X_ERR_EP_CNT_SYNC
@ GET4_V2X_ERR_UNKNOWN
@ GET4_V2X_ERR_READ_INIT
@ GET4_V2X_ERR_DLL_RESET
@ GET4_V2X_ERR_ADD_RIS_EDG
@ GET4_V2X_ERR_TOK_RING_ST
@ GET4_V2X_ERR_TOKEN
@ GET4_V2X_ERR_TOT_OVERWRT
@ GET4_V2X_ERR_READOUT_ERR
@ GET4_V2X_ERR_EVT_DISCARD
@ GET4_V2X_ERR_UNPAIR_FALL
@ GET4_V2X_ERR_CHAN_STATE
@ GET4_V2X_ERR_SYNC
@ GET4_V2X_ERR_SEQUENCE_ER
const uint32_t kuChipIdMergedEpoch
const uint32_t kuFeePulserChannel
const uint32_t kuEpochCounterSz
const uint64_t kulEpochCycleFieldSz
@ SYS_GET4_SYNC_MISS