CbmRoot
Loading...
Searching...
No Matches
CbmStar2019EventBuilderEtofAlgo.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// ----- CbmStar2019EventBuilderEtofAlgo -----
8// ----- Created 03.11.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
14#include "CbmHistManager.h"
15#include "CbmStar2019TofPar.h"
16#include "FairRootManager.h"
17#include "FairRun.h"
18#include "FairRunOnline.h"
19#include "FairRuntimeDb.h"
20#include "TCanvas.h"
21#include "TH1.h"
22#include "TH2.h"
23#include "TList.h"
24#include "TProfile.h"
25#include "TROOT.h"
26#include "TString.h"
27
28#include <Logger.h>
29
30#include <cstdint>
31#include <fstream>
32#include <iomanip>
33#include <iostream>
34
35// -------------------------------------------------------------------------
38 ,
40 fbMonitorMode(kFALSE)
41 , fbDebugMonitorMode(kFALSE)
42 , fbStoreLostEventMsg(kFALSE)
43 , fbAddStatusToEvent(kTRUE)
44 , fUnpackPar(nullptr)
45 , fuNrOfGdpbs(0)
51 , fuNrOfGet4(0)
54 , fuNrOfGbtx(0)
55 , fuNrOfModules(0)
56 , fviNrOfRpc()
57 , fviRpcType()
58 , fviRpcSide()
59 , fviModuleId()
64 , fuMinTotPulser(90)
65 , fuMaxTotPulser(110)
67 , fdTsStartTime(-1.0)
68 , fdTsStopTimeCore(-1.0)
69 , fuCurrentMs(0)
70 , fdMsTime(-1.0)
71 , fuMsIndex(0)
72 , fuGdpbId(0)
73 , fuGdpbNr(0)
74 , fuGet4Id(0)
75 , fuGet4Nr(0)
76 , fiEquipmentId(0)
84 , fbTriggerFoundA(kFALSE)
85 , fbTriggerFoundB(kFALSE)
86 , fbTriggerFoundC(kFALSE)
116 , fvhTriggerDt()
120 , fhEventSizeDistribution(nullptr)
121 , fhEventSizeEvolution(nullptr)
122 , fhEventNbEvolution(nullptr)
125 , fhRawTriggersStats(nullptr)
126 , fhRawTriggersStatsCore(nullptr)
127 , fhRawTriggersStatsOver(nullptr)
128 , fhRawTriggersStatsSel(nullptr)
130 , fcTimeToTrigRaw(nullptr)
131 , fcTimeToTrigSel(nullptr)
132 , fcTrigDistMs(nullptr)
133 , fcMessDistMs(nullptr)
134 , fcEventBuildStats(nullptr)
135 , fcTriggerStats(nullptr)
136{
137}
139{
141 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
142 fvvmEpSupprBuffer[uGdpb].clear();
143 fvvBufferMajorAsicErrors[uGdpb].clear();
144 fvvBufferMessages[uGdpb].clear();
145 fvvBufferTriggers[uGdpb].clear();
146 } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
147}
148
149// -------------------------------------------------------------------------
151{
152 LOG(info) << "Initializing STAR eTOF 2019 event builder algo";
153
154 return kTRUE;
155}
163
164// -------------------------------------------------------------------------
166{
167 LOG(info) << "Init parameter containers for CbmStar2019EventBuilderEtofAlgo";
168 Bool_t initOK = ReInitContainers();
169
170 return initOK;
171}
173{
174 LOG(info) << "**********************************************";
175 LOG(info) << "ReInit parameter containers for CbmStar2019EventBuilderEtofAlgo";
176
177 fUnpackPar = (CbmStar2019TofPar*) fParCList->FindObject("CbmStar2019TofPar");
178 if (nullptr == fUnpackPar) return kFALSE;
179
180 Bool_t initOK = InitParameters();
181
182 return initOK;
183}
185{
186 if (nullptr == fParCList) fParCList = new TList();
187 fUnpackPar = new CbmStar2019TofPar("CbmStar2019TofPar");
188 fParCList->Add(fUnpackPar);
189
190 return fParCList;
191}
193{
195 // fbMonitorMode = fUnpackPar->GetMonitorMode();
196 LOG(info) << "Monitor mode: " << (fbMonitorMode ? "ON" : "OFF");
197
198 // fbDebugMonitorMode = fUnpackPar->GetDebugMonitorMode();
199 LOG(info) << "Debug Monitor mode: " << (fbDebugMonitorMode ? "ON" : "OFF");
200
201 LOG(info) << "Store Lost Event Msg in event: " << (fbStoreLostEventMsg ? "ON" : "OFF");
202
203 LOG(info) << "Add status pattern to event: " << (fbAddStatusToEvent ? "ON" : "OFF");
204
206 fuNrOfGdpbs = fUnpackPar->GetNrOfGdpbs();
207 LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
208
209 fuNrOfFeePerGdpb = fUnpackPar->GetNrOfFeePerGdpb();
210 LOG(info) << "Nr. of FEEs per Tof GDPB: " << fuNrOfFeePerGdpb;
211
212 fuNrOfGet4PerFee = fUnpackPar->GetNrOfGet4PerFee();
213 LOG(info) << "Nr. of GET4 per Tof FEE: " << fuNrOfGet4PerFee;
214
215 fuNrOfChannelsPerGet4 = fUnpackPar->GetNrOfChannelsPerGet4();
216 LOG(info) << "Nr. of channels per GET4: " << fuNrOfChannelsPerGet4;
217
219 LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
220
222 LOG(info) << "Nr. of GET4s: " << fuNrOfGet4;
223
225 LOG(info) << "Nr. of GET4s per GDPB: " << fuNrOfGet4PerGdpb;
226
228 LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
229
230 fGdpbIdIndexMap.clear();
231 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
232 fGdpbIdIndexMap[fUnpackPar->GetGdpbId(i)] = i;
233 LOG(info) << "GDPB Id of TOF " << Form("%02d", i) << " : " << std::hex << Form("0x%04x", fUnpackPar->GetGdpbId(i))
234 << std::dec;
235 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
236
237 fuNrOfGbtx = fUnpackPar->GetNrOfGbtx();
238 LOG(info) << "Nr. of GBTx: " << fuNrOfGbtx;
239
240 fuNrOfModules = fUnpackPar->GetNrOfModules();
241 LOG(info) << "Nr. of GBTx: " << fuNrOfModules;
242
244 fviRpcType.resize(fuNrOfGbtx);
245 fviModuleId.resize(fuNrOfGbtx);
246 fviNrOfRpc.resize(fuNrOfGbtx);
247 fviRpcSide.resize(fuNrOfGbtx);
248 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx) {
249 fviNrOfRpc[uGbtx] = fUnpackPar->GetNrOfRpc(uGbtx);
250 fviRpcType[uGbtx] = fUnpackPar->GetRpcType(uGbtx);
251 fviRpcSide[uGbtx] = fUnpackPar->GetRpcSide(uGbtx);
252 fviModuleId[uGbtx] = fUnpackPar->GetModuleId(uGbtx);
253 } // for( UInt_t uGbtx = 0; uGbtx < uNrOfGbtx; ++uGbtx)
254
255 LOG(info) << "Nr. of RPCs per GBTx: ";
256 std::stringstream ss;
257 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
258 ss << Form(" %2d", fviNrOfRpc[uGbtx]);
259 LOG(info) << ss.str();
260
261 LOG(info) << "RPC type per GBTx: ";
262 ss.clear();
263 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
264 ss << Form(" %2d", fviRpcType[uGbtx]);
265 LOG(info) << ss.str();
266
267 LOG(info) << "RPC side per GBTx: ";
268 ss.clear();
269 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
270 ss << Form(" %2d", fviRpcSide[uGbtx]);
271 LOG(info) << ss.str();
272
273 LOG(info) << "Module ID per GBTx: ";
274 ss.clear();
275 for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
276 ss << Form(" %2d", fviModuleId[uGbtx]);
277 LOG(info) << ss.str();
278
280 fdMsSizeInNs = fUnpackPar->GetSizeMsInNs();
281 LOG(info) << "Timeslice parameters: each MS is " << fdMsSizeInNs << " ns";
282
284 fdAllowedTriggersSpread = fUnpackPar->GetStarTriggAllowedSpread();
286 fdStarTriggerDelay.resize(fuNrOfGdpbs, 0.0);
296 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
297 fdStarTriggerDeadtime[uGdpb] = fUnpackPar->GetStarTriggDeadtime(uGdpb);
298 fdStarTriggerDelay[uGdpb] = fUnpackPar->GetStarTriggDelay(uGdpb);
299 fdStarTriggerWinSize[uGdpb] = fUnpackPar->GetStarTriggWinSize(uGdpb);
300 LOG(info) << Form("Trigger window parameters for gDPB %2u are: ", uGdpb) << fdStarTriggerDeadtime[uGdpb]
301 << " ns deadtime, " << fdStarTriggerDelay[uGdpb] << " ns delay, " << fdStarTriggerWinSize[uGdpb]
302 << " ns window width, " << fdAllowedTriggersSpread << " ns allowed spread";
303 } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
304
306 fvulCurrentEpoch.resize(fuNrOfGdpbs, 0);
309
315
317 fvulGdpbTsMsb.resize(fuNrOfGdpbs, 0);
318 fvulGdpbTsLsb.resize(fuNrOfGdpbs, 0);
319 fvulStarTsMsb.resize(fuNrOfGdpbs, 0);
320 fvulStarTsMid.resize(fuNrOfGdpbs, 0);
323 fvuStarTokenLast.resize(fuNrOfGdpbs, 0);
331
332 return kTRUE;
333}
334// -------------------------------------------------------------------------
335
336void CbmStar2019EventBuilderEtofAlgo::AddMsComponentToList(size_t component, UShort_t usDetectorId)
337{
339 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
340 if (component == fvMsComponentsList[uCompIdx]) return;
341
343 fvMsComponentsList.push_back(component);
344
345 LOG(info) << "CbmStar2019EventBuilderEtofAlgo::AddMsComponentToList => Component " << component
346 << " with detector ID 0x" << std::hex << usDetectorId << std::dec << " added to list";
347}
348// -------------------------------------------------------------------------
349
351{
352 fulCurrentTsIndex = ts.index();
353 fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
354
356 if (-1.0 == fdTsCoreSizeInNs) {
357 fuNbCoreMsPerTs = ts.num_core_microslices();
358 fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
361 LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs << " Core MS and " << fuNbOverMsPerTs
362 << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs << " ns and a full duration of "
363 << fdTsFullSizeInNs << " ns";
364
368 LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
369 } // if( -1.0 == fdTsCoreSizeInNs )
370
373 // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIndex, fdTsStartTime, fdTsStopTimeCore );
374
377 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
378 if (fdStarTriggerDelay[uGdpb] < 0.0) {
380 if (fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb] < 0.0) {
383 // << Accept more than needed as this should be safer and small amounts >>
385 + 2.0 * fdStarTriggerWinSize[uGdpb]; // + fdStarTriggerWinSize[ uGdpb ];
388
389 } // if( fdStarTriggerDelay[ uGdpb ] + fdStarTriggerWinSize[ uGdpb ] < 0.0 )
390 else {
393 // << Accept more than needed as this should be safer and small amounts >>
395 + 2.0 * fdStarTriggerWinSize[uGdpb]; // + fdStarTriggerDelay[ uGdpb ];
398 } // else of if( fdStarTriggerDelay[ uGdpb ] + fdStarTriggerWinSize[ uGdpb ] < 0.0 )
399 } // if( fdStarTriggerDeadtime[ uGdpb ] < 0.0 )
400 else {
402 // << Accept more than needed as this should be safer and small amounts >>
403 fvdMessCandidateTimeStart[uGdpb] = fdTsStartTime; // - fdAllowedTriggersSpread + fdStarTriggerDelay[ uGdpb ];
408 } // else of if( fdStarTriggerDelay[ uGdpb ] < 0.0 )
409 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
410
412 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
413 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
414
416 fbTriggerFoundA = kFALSE;
417 fbTriggerFoundB = kFALSE;
418 fbTriggerFoundC = kFALSE;
419
423
425 for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
426 if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
427 LOG(error) << "Failed to process ts " << fulCurrentTsIndex << " MS " << fuMsIndex << " for component "
428 << uMsComp;
429 return kFALSE;
430 } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
431 } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
432 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
433
436 fvEventsBuffer.clear();
437
439 if (kFALSE == BuildEvents()) {
440 LOG(error) << "Failed to build events in ts " << fulCurrentTsIndex;
441 return kFALSE;
442 } // if( kFALSE == BuildEvents() )
443
445 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
446 fvvmEpSupprBuffer[uGdpb].clear();
447 fvvBufferMajorAsicErrors[uGdpb].clear();
448 fvvBufferMessages[uGdpb].clear();
449 fvvBufferTriggers[uGdpb].clear();
450
452 fvbGdpbLastEnablePattern[uGdpb] = 0;
453 fvbGdpbLastResyncPattern[uGdpb] = 0;
454 fvSectorStatusPattern[uGdpb].clear();
455 } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
456
458 if (fbMonitorMode) {
459 if (kFALSE == FillHistograms()) {
460 LOG(error) << "Failed to fill histos in ts " << fulCurrentTsIndex;
461 return kFALSE;
462 } // if( kFALSE == FillHistograms() )
463 } // if( fbMonitorMode )
464
465 return kTRUE;
466}
467
468static Int_t iWarn = 0;
469static Int_t iWarnMess = 0;
470
471Bool_t CbmStar2019EventBuilderEtofAlgo::ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx)
472{
473 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
474 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
475
477 fuCurrentMs = uMsIdx;
478 fiEquipmentId = msDescriptor.eq_id;
479 fdMsTime = static_cast<double>(msDescriptor.idx);
480 uint32_t size = msDescriptor.size;
481 // fulLastMsIdx = msDescriptor.idx;
482 if (size > 0) LOG(debug) << "Microslice: " << msDescriptor.idx << " has size: " << size;
483
485 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
486
487 /*
488 if( fdStartTimeMsSz < 0 )
489 fdStartTimeMsSz = (1e-9) * fdMsTime;
490
491 fvhMsSzPerLink[ uMsComp ]->Fill(size);
492 if( 2 * fuHistoryHistoSize < (1e-9) * fdMsTime - fdStartTimeMsSz )
493 {
494 // Reset the evolution Histogram and the start time when we reach the end of the range
495 fvhMsSzTimePerLink[ uMsComp ]->Reset();
496 fdStartTimeMsSz = (1e-9) * fdMsTime;
497 } // if( 2 * fuHistoryHistoSize < (1e-9) * fdMsTime - fdStartTimeMsSz )
498 fvhMsSzTimePerLink[ uMsComp ]->Fill((1e-9) * fdMsTime - fdStartTimeMsSz, size);
499*/
500
502 if (0 != (size % fUnpackPar->GetNbByteMessage()))
503 LOG(error) << "The input microslice buffer does NOT "
504 << "contain only complete nDPB messages!";
505
507 uint32_t uNbMessages = (size - (size % fUnpackPar->GetNbByteMessage())) / fUnpackPar->GetNbByteMessage();
508
511
513 auto it = fGdpbIdIndexMap.find(fuGdpbId);
514 if (it == fGdpbIdIndexMap.end()) {
515 iWarn++;
516 LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex << fuGdpbId << std::dec
517 << " in microslice " << fdMsTime << "\n"
518 << "If valid this index has to be added in the TOF parameter "
519 "file in the RocIdArray field";
520 if (iWarn == 100) LOG(fatal) << "Got max number of Warnings!";
521 return kFALSE;
522 } // if( it == fGdpbIdIndexMap.end() )
523 else
525
533 } // if( 0 < fuNbOverMsPerTs && fuNbCoreMsPerTs == fuCurrentMs )
534
536 if (0 < fuNbOverMsPerTs && 0 == fuCurrentMs) {
542 } // if( 0 < fuNbOverMsPerTs && 0 == fuCurrentMs )
543
544 // Prepare variables for the loop on contents
545 Int_t messageType = -111;
546 const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
547 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
550 break;
551
552 // Fill message
553 uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]);
554
556 if (0 == uIdx) {
557 // std::cout << Form( "gDPB %2d", fuGdpbNr) << " Epoch cycle " << Form( "0x%012lx", ulData ) << std::endl;
558 ProcessEpochCycle(ulData);
559 continue;
560 } // if( 0 == uIdx )
561
562 gdpbv100::Message mess(ulData);
564 messageType = mess.getMessageType();
565 if (fUnpackPar->GetNrOfGet4PerGdpb() <= mess.getGdpbGenChipId() && 255 > mess.getGdpbGenChipId()) { //FIXME
566 if (iWarnMess < 100)
567 LOG(warn) << iWarnMess << ": Invalid ChipID " << mess.getGdpbGenChipId() << " in messageType " << messageType;
568 iWarnMess++;
569 continue;
570 }
571
572 fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx(mess.getGdpbGenChipId());
574 /*
575 if( 5916 == fulCurrentTsIndex && gdpbv100::MSG_STAR_TRI_A <= messageType)
576 mess.printDataCout();
577*/
578 /*
579 if( gdpbv100::MSG_STAR_TRI_A <= messageType )
580 mess.printDataCout();
581 continue;
582*/
583
585 LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS " << fuNrOfGet4PerGdpb
586 << " set in parameters.";
587
588 switch (messageType) {
589 case gdpbv100::MSG_HIT: {
590 if (mess.getGdpbHitIs24b()) {
591 LOG(error) << "This event builder does not support 24b hit message!!!.";
592 continue;
593 } // if( getGdpbHitIs24b() )
594 else {
595 fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
596 } // else of if( getGdpbHitIs24b() )
597 break;
598 } // case gdpbv100::MSG_HIT:
599 case gdpbv100::MSG_EPOCH: {
601 ProcessEpoch(mess);
602 /*
603 if( kTRUE == fbPrintAllEpochsEnable )
604 {
605 LOG(info) << "Epoch: " << Form("0x%08x ", fuGdpbId)
606 << ", Merg"
607 << ", Link " << std::setw(1) << mess.getGdpbEpLinkId()
608 << ", epoch " << std::setw(8) << mess.getGdpbEpEpochNb()
609 << ", Sync " << std::setw(1) << mess.getGdpbEpSync()
610 << ", Data loss " << std::setw(1) << mess.getGdpbEpDataLoss()
611 << ", Epoch loss " << std::setw(1) << mess.getGdpbEpEpochLoss()
612 << ", Epoch miss " << std::setw(1) << mess.getGdpbEpMissmatch();
613 } // if( kTRUE == fbPrintAllEpochsEnable )
614*/
615 } // if this epoch message is a merged one valid for all chips
616 else {
618 LOG(debug2) << "This event builder does not support unmerged epoch "
619 "messages!!!.";
620 continue;
621 } // if single chip epoch message
622 break;
623 } // case gdpbv100::MSG_EPOCH:
624 case gdpbv100::MSG_SLOWC: {
625 fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
626 break;
627 } // case gdpbv100::MSG_SLOWC:
628 case gdpbv100::MSG_SYST: {
629 fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
630 break;
631 } // case gdpbv100::MSG_SYST:
636 ProcessStarTrigger(mess);
637
640 /*
641 if( gdpbv100::MSG_STAR_TRI_A == messageType )
642 {
643 } // if( gdpbv100::MSG_STAR_TRI_A == messageType )
644*/
645 break;
646 } // case gdpbv100::MSG_STAR_TRI_A-D
647 default:
648 LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
649 << " not included in Get4 unpacker.";
650 } // switch( mess.getMessageType() )
651 } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
652
653 return kTRUE;
654}
655
656// -------------------------------------------------------------------------
658{
659 ULong64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz;
660 /*
661 if( fuRawDataPrintMsgIdx < fuRawDataPrintMsgNb || fair::Logger::Logging(fair::Severity::debug2) )
662 {
663 LOG(info) << "CbmMcbm2018MonitorTof::ProcessEpochCyle => "
664 << Form( " TS %5d MS %3d In data 0x%016X Cycle 0x%016X",
665 fulCurrentTsIndex, fuCurrentMs, ulCycleData, ulEpochCycleVal );
666 fuRawDataPrintMsgIdx ++;
667 }
668*/
669 if (!(ulEpochCycleVal == fvulCurrentEpochCycle[fuGdpbNr] || ulEpochCycleVal == fvulCurrentEpochCycle[fuGdpbNr] + 1)) {
670 LOG(warning) << "CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
671 << " Missmatch in epoch cycles detected for Gdpb " << fuGdpbNr
672 << ", probably fake cycles due to epoch index corruption! "
673 << Form(" Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuGdpbNr],
674 ulEpochCycleVal);
675 }
676 if (ulEpochCycleVal != fvulCurrentEpochCycle[fuGdpbNr]) {
677 LOG(info) << "CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
678 << " New epoch cycle for Gdpb " << fuGdpbNr
679 << Form(": Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuGdpbNr], ulEpochCycleVal);
680 } // if( ulEpochCycleVal != fvulCurrentEpochCycle[fuGdpbNr] )
681 fvulCurrentEpochCycle[fuGdpbNr] = ulEpochCycleVal;
682
683 return;
684}
685
687{
688 ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
689 /*
690 * /// FIXME: Need proper handling of overlap MS
691 if( 0 < fvulCurrentEpoch[ fuGdpbNr ] && ulEpochNr < fvulCurrentEpoch[ fuGdpbNr ] )
692 {
693 std::cout << Form( "gDPB %2d", fuGdpbNr) << " New Epoch cycle "
694 << Form( "0x%012llx old Ep %08llx new Ep %08llx", fvulCurrentEpochCycle[ fuGdpbNr ], fvulCurrentEpoch[ fuGdpbNr ], ulEpochNr )
695 << std::endl;
696 fvulCurrentEpochCycle[ fuGdpbNr ]++;
697 } // if( 0 < fvulCurrentEpoch[ fuGdpbNr ] && ulEpochNr < fvulCurrentEpoch[ fuGdpbNr ] )
698*/
699 fvulCurrentEpoch[fuGdpbNr] = ulEpochNr;
701
702 // fulCurrentEpochTime = mess.getMsgFullTime(ulEpochNr);
703
706 if (0 < ulEpochNr) mess.setGdpbEpEpochNb(ulEpochNr - 1);
707 else
709
712
717 } // if( fuNbCoreMsPerTs <= fuCurrentMs && fvdMessCandidateTimeStop[ fuGdpbNr ] < fvulCurrentEpochFull[ fuGdpbNr ] * gdpbv100::kdEpochInNs )
718}
719
721{
722 Int_t iMsgIndex = mess.getStarTrigMsgIndex();
723
724 switch (iMsgIndex) {
725 case 0: {
727
730 fhRawTriggersStats->Fill(0., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
732 fhRawTriggersStatsCore->Fill(0., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
733 else
734 fhRawTriggersStatsOver->Fill(0., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
735
736 if (kTRUE == fbTriggerFoundA)
737 LOG(info) << Form("Problem: Overwritting a A trigger in TS %12llu MS %3u Core? %u", fulCurrentTsIndex,
739 << Form(" (%u %u %u)", fbTriggerFoundA, fbTriggerFoundB, fbTriggerFoundC);
740 } // if( fbMonitorMode && fbDebugMonitorMode )
741 fbTriggerFoundA = kTRUE;
742
743 break;
744 } // 1st trigger message
745 case 1: {
748
751 fhRawTriggersStats->Fill(1., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
753 fhRawTriggersStatsCore->Fill(1., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
754 else
755 fhRawTriggersStatsOver->Fill(1., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
756
757 if (kFALSE == fbTriggerFoundA)
758 LOG(info) << Form("Problem: Found B trigger before A in TS %12llu MS %3u", fulCurrentTsIndex, fuMsIndex);
759
760 if (kTRUE == fbTriggerFoundB)
761 LOG(info) << Form("Problem: Overwritting a B trigger in TS %12llu MS %3u Core? %u", fulCurrentTsIndex,
763 << Form(" (%u %u %u)", fbTriggerFoundA, fbTriggerFoundB, fbTriggerFoundC);
764 } // if( fbMonitorMode && fbDebugMonitorMode )
765 fbTriggerFoundB = kTRUE;
766
767 break;
768 } // 2nd trigger message
769 case 2: {
771
774 fhRawTriggersStats->Fill(2., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
776 fhRawTriggersStatsCore->Fill(2., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
777 else
778 fhRawTriggersStatsOver->Fill(2., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
779
780 if (kFALSE == fbTriggerFoundB || kFALSE == fbTriggerFoundA)
781 LOG(info) << Form("Problem: Found C trigger before A or B in TS %12llu MS %3u", fulCurrentTsIndex, fuMsIndex);
782
783 if (kTRUE == fbTriggerFoundC)
784 LOG(info) << Form("Problem: Overwritting a C trigger in TS %12llu MS %3u Core? %u", fulCurrentTsIndex,
786 << Form(" (%u %u %u)", fbTriggerFoundA, fbTriggerFoundB, fbTriggerFoundC);
787 } // if( fbMonitorMode && fbDebugMonitorMode )
788 fbTriggerFoundC = kTRUE;
789
790 break;
791 } // 3rd trigger message
792 case 3: {
793 ULong64_t ulNewGdpbTsFull = (fvulGdpbTsMsb[fuGdpbNr] << 24) + (fvulGdpbTsLsb[fuGdpbNr]);
794 ULong64_t ulNewStarTsFull =
796 UInt_t uNewToken = mess.getStarTokenStarD();
797 UInt_t uNewDaqCmd = mess.getStarDaqCmdStarD();
798 UInt_t uNewTrigCmd = mess.getStarTrigCmdStarD();
799
803 if (kFALSE == fbTriggerFoundC || kFALSE == fbTriggerFoundB || kFALSE == fbTriggerFoundA) {
805 LOG(info) << Form("Problem: Found D trigger before A or B or C in TS "
806 "%12llu MS %3u Core? %u",
808 << Form(" (%u %u %u) token %5u", fbTriggerFoundA, fbTriggerFoundB, fbTriggerFoundC, uNewToken);
809
811 fbTriggerFoundA = kFALSE;
812 fbTriggerFoundB = kFALSE;
813 fbTriggerFoundC = kFALSE;
814
816 if (0 == fuCurrentMs) return;
817 } // if( kFALSE == fbTriggerFoundC || kFALSE == fbTriggerFoundB || kFALSE == fbTriggerFoundA )
818
820 fbTriggerFoundA = kFALSE;
821 fbTriggerFoundB = kFALSE;
822 fbTriggerFoundC = kFALSE;
823
825 fhRawTriggersStats->Fill(3., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
827 fhRawTriggersStatsCore->Fill(3., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
828 else
829 fhRawTriggersStatsOver->Fill(3., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
830 } // if( fbMonitorMode && fbDebugMonitorMode )
831
832 /*
833 UInt_t uNewTrigWord = ( (uNewTrigCmd & 0x00F) << 16 )
834 + ( (uNewDaqCmd & 0x00F) << 12 )
835 + ( (uNewToken & 0xFFF) );
836 LOG(info) << "New STAR trigger "
837 << " TS " << fulCurrentTsIndex
838 << " gDBB #" << fuGdpbNr << " "
839 << Form("token = %5u ", uNewToken )
840 << Form("gDPB ts = %12llu ", ulNewGdpbTsFull )
841 << Form("STAR ts = %12llu ", ulNewStarTsFull )
842 << Form("DAQ cmd = %2u ", uNewDaqCmd )
843 << Form("TRG cmd = %2u ", uNewTrigCmd )
844 << Form("TRG Wrd = %5x ", uNewTrigWord );
845*/
846
847 if ((uNewToken == fvuStarTokenLast[fuGdpbNr]) && (ulNewGdpbTsFull == fvulGdpbTsFullLast[fuGdpbNr])
848 && (ulNewStarTsFull == fvulStarTsFullLast[fuGdpbNr]) && (uNewDaqCmd == fvuStarDaqCmdLast[fuGdpbNr])
849 && (uNewTrigCmd == fvuStarTrigCmdLast[fuGdpbNr])) {
850 UInt_t uTrigWord = ((fvuStarTrigCmdLast[fuGdpbNr] & 0x00F) << 16)
851 + ((fvuStarDaqCmdLast[fuGdpbNr] & 0x00F) << 12) + ((fvuStarTokenLast[fuGdpbNr] & 0xFFF));
852 LOG(warning) << "Possible error: identical STAR tokens found twice in "
853 "a row => ignore 2nd! "
854 << " TS " << fulCurrentTsIndex << " gDBB #" << fuGdpbNr << " "
855 << Form("token = %5u ", fvuStarTokenLast[fuGdpbNr])
856 << Form("gDPB ts = %12llu ", fvulGdpbTsFullLast[fuGdpbNr])
857 << Form("STAR ts = %12llu ", fvulStarTsFullLast[fuGdpbNr])
858 << Form("DAQ cmd = %2u ", fvuStarDaqCmdLast[fuGdpbNr])
859 << Form("TRG cmd = %2u ", fvuStarTrigCmdLast[fuGdpbNr]) << Form("TRG Wrd = %5x ", uTrigWord);
860 return;
861 } // if exactly same message repeated
862
863 // GDPB TS counter reset detection
864 if (ulNewGdpbTsFull < fvulGdpbTsFullLast[fuGdpbNr])
865 LOG(debug) << "Probable reset of the GDPB TS: old = " << Form("%16llu", fvulGdpbTsFullLast[fuGdpbNr])
866 << " new = " << Form("%16llu", ulNewGdpbTsFull) << " Diff = -"
867 << Form("%8llu", fvulGdpbTsFullLast[fuGdpbNr] - ulNewGdpbTsFull) << " GDPB #"
868 << Form("%2u", fuGdpbNr);
869
870 // STAR TS counter reset detection
871 if (ulNewStarTsFull < fvulStarTsFullLast[fuGdpbNr])
872 LOG(debug) << "Probable reset of the STAR TS: old = " << Form("%16llu", fvulStarTsFullLast[fuGdpbNr])
873 << " new = " << Form("%16llu", ulNewStarTsFull) << " Diff = -"
874 << Form("%8llu", fvulStarTsFullLast[fuGdpbNr] - ulNewStarTsFull) << " GDPB #"
875 << Form("%2u", fuGdpbNr);
876
877 /*
878 LOG(info) << "Updating trigger token for " << fuGdpbNr
879 << " " << fvuStarTokenLast[fuGdpbNr] << " " << uNewToken;
880*/
881
883 CbmTofStarTrigger2019 newTrig(ulNewGdpbTsFull, ulNewStarTsFull, uNewToken, uNewDaqCmd, uNewTrigCmd, fuGdpbId);
884 Double_t dTriggerTime = newTrig.GetFullGdpbTs() * gdpbv100::kdClockCycleSizeNs;
885 if (fvdTrigCandidateTimeStart[fuGdpbNr] < dTriggerTime && dTriggerTime < fvdTrigCandidateTimeStop[fuGdpbNr]) {
886 fvvBufferTriggers[fuGdpbNr].push_back(newTrig);
887
889 fhRawTriggersStatsSel->Fill(0., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
891 fhRawTriggersStatsSel->Fill(1., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
892 else
893 fhRawTriggersStatsSel->Fill(2., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
894 } // if( fbMonitorMode && fbDebugMonitorMode )
895 } // if( fvdTrigCandidateTimeStart[ fuGdpbNr ] < dTriggerTime && dTriggerTime < fvdTrigCandidateTimeStop[ fuGdpbNr ] )
896 else if (fuNbCoreMsPerTs <= fuCurrentMs && fvdTrigCandidateTimeStop[fuGdpbNr] < dTriggerTime) {
899 } // else if( fuNbCoreMsPerTs <= fuCurrentMs && fvdTrigCandidateTimeStop[ fuGdpbNr ] < dTriggerTime )
900
901 // if( fuCurrentMs < fuNbCoreMsPerTs )
902 {
903 // ULong64_t ulGdpbTsDiff = ulNewGdpbTsFull - fvulGdpbTsFullLast[fuGdpbNr];
904 fvulGdpbTsFullLast[fuGdpbNr] = ulNewGdpbTsFull;
905 fvulStarTsFullLast[fuGdpbNr] = ulNewStarTsFull;
906 fvuStarTokenLast[fuGdpbNr] = uNewToken;
907 fvuStarDaqCmdLast[fuGdpbNr] = uNewDaqCmd;
908 fvuStarTrigCmdLast[fuGdpbNr] = uNewTrigCmd;
909 }
913 fhRawTriggersStats->Fill(4., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
915 fhRawTriggersStatsCore->Fill(4., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
916 else
917 fhRawTriggersStatsOver->Fill(4., fUnpackPar->GetGdpbToSectorOffset() + fuGdpbNr);
918 fvhTriggerDistributionInTs[fuGdpbNr]->Fill((dTriggerTime - fdTsStartTime) / 1000.0);
919 fvhTriggerDistributionInMs[fuGdpbNr]->Fill((dTriggerTime - fdMsTime) / 1000.0);
920
921 if ((dTriggerTime - fdMsTime) / 1000.0 < -1000) {
922 LOG(info) << Form("Trigger in wrong MS TS %6llu", fulCurrentTsIndex) << Form(" MS %3u ", fuMsIndex)
923 << Form(" Sector %3u ", fuGdpbNr + 13) << Form(" Ttrig %15.2f", dTriggerTime)
924 << Form(" Tms %15.2f", fdMsTime) << Form(" dT %15.5f", ((dTriggerTime - fdMsTime) / 1000.0));
925 LOG(info) << Form("Full token, gDPB TS LSB bits: 0x%16llx, STAR TS "
926 "MSB bits: 0x%16llx, token is %4u",
927 ulNewGdpbTsFull, ulNewStarTsFull, uNewToken);
928 } // if( (dTriggerTime - fdMsTime) / 1000.0 < -1000 )
929 } // if( fbMonitorMode && fbDebugMonitorMode )
930
931 // LOG(info) << "First full trigger in TS " << fulCurrentTsIndex;
932
933 break;
934 } // case 3
935 default: LOG(error) << "Unknown Star Trigger messageindex: " << iMsgIndex;
936 } // switch( iMsgIndex )
937}
938
939// -------------------------------------------------------------------------
941{
942 Int_t iBufferSize = fvvmEpSupprBuffer[fuGdpbNr].size();
943
944 if (0 == iBufferSize) return;
945
946 LOG(debug) << "Now processing stored messages for for gDPB " << fuGdpbNr << " with epoch number "
947 << (fvulCurrentEpoch[fuGdpbNr] - 1);
948
951 std::stable_sort(fvvmEpSupprBuffer[fuGdpbNr].begin(), fvvmEpSupprBuffer[fuGdpbNr].begin());
952
954 ULong64_t ulCurEpochGdpbGet4 = fvulCurrentEpochFull[fuGdpbNr];
955
957 if (0 == ulCurEpochGdpbGet4) return;
958
960 ulCurEpochGdpbGet4--;
961
962 Int_t messageType = -111;
963 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
964
965 messageType = fvvmEpSupprBuffer[fuGdpbNr][iMsgIdx].getMessageType();
966
967 fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx(fvvmEpSupprBuffer[fuGdpbNr][iMsgIdx].getGdpbGenChipId());
969
971 gdpbv100::FullMessage fullMess(fvvmEpSupprBuffer[fuGdpbNr][iMsgIdx], ulCurEpochGdpbGet4);
972
974 switch (messageType) {
975 case gdpbv100::MSG_HIT: {
976 // ProcessHit( fullMess, ulCurEpochGdpbGet4 );
978 break;
979 } // case gdpbv100::MSG_HIT:
980 case gdpbv100::MSG_SLOWC: {
981 // ProcessSlCtrl( fullMess, ulCurEpochGdpbGet4 );
983 break;
984 } // case gdpbv100::MSG_SLOWC:
985 case gdpbv100::MSG_SYST: {
986 if (gdpbv100::SYS_PATTERN == fullMess.getGdpbSysSubType()) {
987 if (fbAddStatusToEvent) ProcessPattern(fullMess, ulCurEpochGdpbGet4);
988 } // if( gdpbv100::SYS_PATTERN == fvvmEpSupprBuffer[ fuGdpbNr ][ iMsgIdx ].getGdpbSysSubType() )
989 /*
990 else ProcessSysMess( fullMess, ulCurEpochGdpbGet4 );
991*/
992 else
994
995 break;
996 } // case gdpbv100::MSG_SYST:
1001 case gdpbv100::MSG_STAR_TRI_D: break;
1002 default:
1003 LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1004 << " not included in Get4 unpacker.";
1005 } // switch( mess.getMessageType() )
1006 } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
1007
1008 fvvmEpSupprBuffer[fuGdpbNr].clear();
1009}
1011{
1013 uint16_t usG4ErrorType = fullMess.getGdpbSysErrData();
1015 && ((usG4ErrorType < gdpbv100::GET4_V2X_ERR_TOT_OVERWRT && gdpbv100::GET4_V2X_ERR_LOST_EVT != usG4ErrorType)
1016 || usG4ErrorType > gdpbv100::GET4_V2X_ERR_SEQUENCE_ER)) {
1017 fvvBufferMajorAsicErrors[fuGdpbNr].push_back(fullMess);
1018 return;
1019 } // if GET4 error out of TOT/hit building error range
1020 else if (fbStoreLostEventMsg && gdpbv100::GET4_V2X_ERR_LOST_EVT == usG4ErrorType) {
1021 fvvBufferMajorAsicErrors[fuGdpbNr].push_back(fullMess);
1022 return;
1023 } // else if( fbStoreLostEventMsg && gdpbv100::GET4_V2X_ERR_LOST_EVT == usG4ErrorType )
1024
1026 fvhMessDistributionInMs[fuGdpbNr]->Fill((fullMess.GetFullTimeNs() - fdMsTime) / 1000.0);
1027 /*
1028 LOG(info) << Form( "Message Full Time ns: %f MS time ns: %f diff: %f Start %f Stop %f",
1029 fullMess.GetFullTimeNs(), fdMsTime, fullMess.GetFullTimeNs() - fdMsTime,
1030 fvdMessCandidateTimeStart[ fuGdpbNr ], fvdMessCandidateTimeStop[ fuGdpbNr ] );
1031 LOG(info) << Form( "Current epoch %llu Current cycle %llu Current Full epoch %llu",
1032 fvulCurrentEpoch[ fuGdpbNr ], fvulCurrentEpochCycle[ fuGdpbNr ], fvulCurrentEpochFull[ fuGdpbNr ] );
1033*/
1038 fvvBufferMessages[fuGdpbNr].push_back(fullMess);
1039 } // if in limits
1040}
1041
1042// -------------------------------------------------------------------------
1043void CbmStar2019EventBuilderEtofAlgo::ProcessHit(gdpbv100::Message mess, uint64_t /*ulCurEpochGdpbGet4*/)
1044{
1045 UInt_t uChannel = mess.getGdpbHitChanId();
1046 // UInt_t uTot = mess.getGdpbHit32Tot();
1047
1048 // In 32b mode the coarse counter is already computed back to 112 FTS bins
1049 // => need to hide its contribution from the Finetime
1050 // => FTS = Fullt TS modulo 112
1051 // UInt_t uFts = mess.getGdpbHitFullTs() % 112;
1052
1053 // UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1054 // UInt_t uChannelNrInFee = (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel;
1055 // UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
1056 // UInt_t uFeeNrInSys = fuGdpbNr * fuNrOfFeePerGdpb + uFeeNr;
1057 // UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + fUnpackPar->Get4ChanToPadiChan( uChannelNrInFee );
1058 // UInt_t uGbtxNr = (uFeeNr / fUnpackPar->GetNrOfFeePerGbtx());
1059 // UInt_t uFeeInGbtx = (uFeeNr % fUnpackPar->GetNrOfFeePerGbtx());
1060 // UInt_t uGbtxNrInSys = fuGdpbNr * fUnpackPar->GetNrOfGbtxPerGdpb() + uGbtxNr;
1061
1062 // ULong_t ulhitTime = mess.getMsgFullTime( ulCurEpochGdpbGet4 );
1063 // Double_t dHitTime = mess.getMsgFullTimeD( ulCurEpochGdpbGet4 );
1064 // Double_t dHitTot = uTot; // in bins
1065
1066 // UInt_t uFebIdx = (fuGet4Id / fUnpackPar->GetNrOfGet4PerFee());
1067 // UInt_t uFullFebIdx = (fuGdpbNr * fUnpackPar->GetNrOfFeePerGdpb()) + uFebIdx;
1068
1069 UInt_t uChanInGdpb = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1070 UInt_t uChanInSyst = fuGdpbNr * fuNrOfChannelsPerGdpb + uChanInGdpb;
1071 if (fUnpackPar->GetNumberOfChannels() < uChanInSyst) {
1072 LOG(error) << "Invalid mapping index " << uChanInSyst << " VS " << fUnpackPar->GetNumberOfChannels() << ", from "
1073 << fuGdpbNr << ", " << fuGet4Id << ", " << uChannel;
1074 return;
1075 } // if( fUnpackPar->GetNumberOfChannels() < uChanUId )
1076}
1077
1078void CbmStar2019EventBuilderEtofAlgo::ProcessSlCtrl(gdpbv100::Message /*mess*/, uint64_t /*ulCurEpochGdpbGet4*/) {}
1079
1081{
1082 switch (mess.getGdpbSysSubType()) {
1084 uint32_t uData = mess.getGdpbSysErrData();
1089 LOG(debug) << " +++++++ > gDPB: " << std::hex << std::setw(4) << fuGdpbId << std::dec
1090 << ", Chip = " << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1091 << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1) << mess.getGdpbSysErrEdge()
1092 << ", Empt = " << std::setw(1) << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1093 << std::setw(2) << uData << std::dec << " -- GET4 V1 Error Event";
1094 else
1095 LOG(debug) << " +++++++ >gDPB: " << std::hex << std::setw(4) << fuGdpbId << std::dec
1096 << ", Chip = " << std::setw(2) << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1097 << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1) << mess.getGdpbSysErrEdge()
1098 << ", Empt = " << std::setw(1) << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1099 << std::setw(2) << uData << std::dec << " -- GET4 V1 Error Event ";
1100 break;
1101 } // case gdpbv100::SYSMSG_GET4_EVENT
1103 LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.getGdpbSysUnkwData() << std::dec
1104 << " Full message: " << std::hex << std::setw(16) << mess.getData() << std::dec;
1105 break;
1106 } // case gdpbv100::SYS_GDPB_UNKWN:
1108 LOG(debug) << "GET4 synchronization pulse missing";
1109 break;
1110 } // case gdpbv100::SYS_GET4_SYNC_MISS:
1111 case gdpbv100::SYS_PATTERN: {
1112 LOG(debug) << "ASIC pattern for missmatch, disable or resync";
1113 break;
1114 } // case gdpbv100::SYS_PATTERN:
1115 default: {
1116 LOG(debug) << "Crazy system message, subtype " << mess.getGdpbSysSubType();
1117 break;
1118 } // default
1119
1120 } // switch( getGdpbSysSubType() )
1121}
1122// -------------------------------------------------------------------------
1124{
1125 uint16_t usType = mess.getGdpbSysPattType();
1126 uint16_t usIndex = mess.getGdpbSysPattIndex();
1127 uint32_t uPattern = mess.getGdpbSysPattPattern();
1128 // std::bitset< 32 > bPattern( mess.getGdpbSysPattPattern() );
1129 UInt_t uNbBits = (kuNbMsgPerPattern - 1 == usIndex ? 16 : 32);
1130
1131 switch (usType) {
1133 // LOG(debug) << Form( "Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1134 for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1135 fvbGdpbLastMissmatchPattern[fuGdpbNr][32 * usIndex + uBit] = (uPattern >> uBit) & 0x1;
1136 // fvbGdpbLastMissmatchPattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1137 } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1138 break;
1139 } // case gdpbv100::PATT_MISSMATCH:
1140 case gdpbv100::PATT_ENABLE: {
1141 // LOG(debug2) << Form( "Enable pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1142 for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1143 fvbGdpbLastEnablePattern[fuGdpbNr][32 * usIndex + uBit] = (uPattern >> uBit) & 0x1;
1144 // fvbGdpbLastEnablePattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1145 } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1146 break;
1147 } // case gdpbv100::PATT_ENABLE:
1148 case gdpbv100::PATT_RESYNC: {
1149 // LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1150 for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1151 fvbGdpbLastResyncPattern[fuGdpbNr][32 * usIndex + uBit] = (uPattern >> uBit) & 0x1;
1152 // fvbGdpbLastResyncPattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1153 } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1154 break;
1155 } // case gdpbv100::PATT_RESYNC:
1156 default: {
1157 LOG(debug) << "Crazy pattern message, subtype " << usType;
1158 break;
1159 } // default
1160 } // switch( usType )
1161
1162 if (kuNbMsgPerPattern - 1 == usIndex) UpdateStatusPatternCurrGdpb();
1163
1164 return;
1165}
1179 std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>> statusIn)
1180{
1182 static constexpr std::bitset<kuNbAsicPerGdpb> kbMask32 {0xFFFFFFFF};
1183
1185 gdpbv100::FullMessage outMess(0, statusIn.first);
1186
1188 const std::bitset<kuNbAsicPerGdpb> bPatterBlock {(statusIn.second >> (32 * uIndex)) & kbMask32};
1189
1191 outMess.setGdpbGenGdpbId(uGdpbId);
1195 outMess.setGdpbSysPattIndex(uIndex);
1196 outMess.setGdpbSysPattPattern(bPatterBlock.to_ulong()); // Safe as we masked with 32b
1197
1198 return outMess;
1199}
1200// -------------------------------------------------------------------------
1201
1203{
1208 std::vector<std::vector<CbmTofStarTrigger2019>::iterator> itTrigger;
1209 std::vector<std::vector<gdpbv100::FullMessage>::iterator> itErrorMessStart;
1210 std::vector<std::vector<gdpbv100::FullMessage>::iterator> itMessStart;
1211 std::vector<std::vector<std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>>>::iterator> itStatUpdtStart;
1212 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1213 itTrigger.push_back(fvvBufferTriggers[uGdpb].begin());
1214 itErrorMessStart.push_back(fvvBufferMajorAsicErrors[uGdpb].begin());
1215 itMessStart.push_back(fvvBufferMessages[uGdpb].begin());
1216 itStatUpdtStart.push_back(fvSectorStatusPattern[uGdpb].begin());
1217 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1218
1220 Bool_t bAllSectAllTriggDone = kTRUE;
1221 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1223 if (fvvBufferTriggers[uGdpb].end() != itTrigger[uGdpb]) {
1224 bAllSectAllTriggDone = kFALSE;
1225 break;
1226 } // if( fvvBufferTriggers[ uGdpb ].end() != (*itTrigger[ uGdpb ]) )
1227 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1228
1232 while (kFALSE == bAllSectAllTriggDone) {
1234 Bool_t bAllSectorsMatch = kTRUE;
1235 UInt_t uFirstStarToken = 0;
1236 UShort_t usFirstStarDaqCmd = 0;
1237 UShort_t usFirstStarTrigCmd = 0;
1238 ULong64_t ulFirstFullGdpbTs = 0;
1239
1242 if (0 == fvvBufferTriggers[0].size()) { bAllSectorsMatch = kFALSE; } // if( 0 == fvvBufferTriggers[ 0 ].size() )
1243 else {
1246 uFirstStarToken = (*itTrigger[0]).GetStarToken();
1247 usFirstStarDaqCmd = (*itTrigger[0]).GetStarDaqCmd();
1248 usFirstStarTrigCmd = (*itTrigger[0]).GetStarTrigCmd();
1249 ulFirstFullGdpbTs = (*itTrigger[0]).GetFullGdpbTs();
1250 for (UInt_t uGdpb = 1; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1251 if (itTrigger[uGdpb] == fvvBufferTriggers[uGdpb].end() || (*itTrigger[uGdpb]).GetStarToken() != uFirstStarToken
1252 || (*itTrigger[uGdpb]).GetStarDaqCmd() != usFirstStarDaqCmd
1253 || (*itTrigger[uGdpb]).GetStarTrigCmd() != usFirstStarTrigCmd) {
1254 bAllSectorsMatch = kFALSE;
1255 break;
1256 } // If end of buffer or any field differs for any gDPB/sector current trigger, not all matched!
1257 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1258 } // else of if( 0 == itTrigger[ uGdpb ].size() )
1259
1260 if (kTRUE == bAllSectorsMatch) {
1263 CbmTofStarSubevent2019 starSubEvent;
1264
1266 Double_t dMeanTriggerGdpbTs = 0;
1267 Double_t dMeanTriggerStarTs = 0;
1268 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1270 dMeanTriggerGdpbTs += (*itTrigger[uGdpb]).GetFullGdpbTs();
1271 dMeanTriggerStarTs += (*itTrigger[uGdpb]).GetFullStarTs();
1272
1274 Long64_t ilTriggerDt =
1275 static_cast<Long64_t>((*itTrigger[uGdpb]).GetFullGdpbTs()) - static_cast<Long64_t>(ulFirstFullGdpbTs);
1276 fvhTriggerDt[uGdpb]->Fill(ilTriggerDt);
1277 } // if( fbMonitorMode && fbDebugMonitorMode )
1278
1280 std::vector<gdpbv100::FullMessage> vTrigMess = (*itTrigger[uGdpb]).GetGdpbMessages();
1281 for (std::vector<gdpbv100::FullMessage>::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end();
1282 ++itMess) {
1283 starSubEvent.AddMsg((*itMess));
1284 } // for( std::vector< gdpbv100::FullMessage >::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end(); ++ itMess )
1285
1286 if (fbAddStatusToEvent) {
1287 /*
1288 LOG(info) << Form( "Trying to add status to event, status buffer size is %d, first test status time is %llu, trigger time is %llu Evt size is %u",
1289 fvSectorStatusPattern[ uGdpb ].size(),
1290 (*itStatUpdtStart[ uGdpb ]).first * gdpbv100::kuCoarseCounterSize,
1291 (*itTrigger[ uGdpb ]).GetFullGdpbTs(),
1292 starSubEvent.GetMsgBuffSize() );
1293*/
1298 while (fvSectorStatusPattern[uGdpb].end() != itStatUpdtStart[uGdpb]
1299 && ((*itStatUpdtStart[uGdpb]).first) * gdpbv100::kuCoarseCounterSize
1300 <= (*itTrigger[uGdpb]).GetFullGdpbTs()) {
1301 ++itStatUpdtStart[uGdpb];
1302 } // while( not at the end of updates vector AND Update time under trigger time )
1304 if (fvSectorStatusPattern[uGdpb].begin() != itStatUpdtStart[uGdpb]) {
1306 --itStatUpdtStart[uGdpb];
1308 uint16_t usGdpbId = fUnpackPar->GetGdpbId(uGdpb);
1309 for (uint32_t uIdx = 0; uIdx < kuNbMsgPerPattern; ++uIdx)
1310 starSubEvent.AddMsg(CreateStatusMessage(usGdpbId, uIdx, (*itStatUpdtStart[uGdpb])));
1311 /*
1312 LOG(info) << Form( "found status time is %llu, diff to trigger time is %llu Evt size is %u",
1313 ( (*itStatUpdtStart[ uGdpb ]).first ) * gdpbv100::kuCoarseCounterSize,
1314 (*itTrigger[ uGdpb ]).GetFullGdpbTs() - ( (*itStatUpdtStart[ uGdpb ]).first ) * gdpbv100::kuCoarseCounterSize,
1315 starSubEvent.GetMsgBuffSize() );
1316*/
1317 } // if( fvSectorStatusPattern[ uGdpb ].begin() != itStatUpdtStart[ uGdpb ] )
1318 } // if( fbAddStatusToEvent )
1319
1321 Double_t dWinBeg =
1322 gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs() + fdStarTriggerDelay[uGdpb];
1323 Double_t dWinEnd = gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs()
1324 + fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb];
1325 Double_t dDeadEnd =
1326 gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs() + fdStarTriggerDeadtime[uGdpb];
1327 Double_t dWinBegErrors = dWinBeg - 2 * gdpbv100::kdEpochInNs;
1328
1330 UInt_t uNbErrorsInEventGdpb = 0;
1331 while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1332 && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinBegErrors) {
1333 ++itErrorMessStart[uGdpb];
1334 } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinBeg - 2 * gdpbv100::kdEpochInNs )
1335 while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1336 && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinEnd) {
1338 if (uNbErrorsInEventGdpb < kuMaxNbErrorsPerGdpbPerEvent) starSubEvent.AddMsg((*itErrorMessStart[uGdpb]));
1339
1340 ++itErrorMessStart[uGdpb];
1341 ++uNbErrorsInEventGdpb;
1342 } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinEnd )
1343
1346 std::vector<gdpbv100::FullMessage>::iterator itFirstMessOutOfDeadtime = itMessStart[uGdpb];
1347 while (
1348 itMessStart[uGdpb] != fvvBufferMessages[uGdpb].end()
1349 && ((*itMessStart[uGdpb]).GetFullTimeNs() < dDeadEnd || (*itMessStart[uGdpb]).GetFullTimeNs() < dWinEnd)) {
1350 Double_t dMessTime = (*itMessStart[uGdpb]).GetFullTimeNs();
1351 /*
1352 if( 5916 == fulCurrentTsIndex )
1353 LOG(info) << Form( "gDPB %2u Match Mess %12f Start %12f Stop %12f dStart %6f dStop %6f",
1354 uGdpb, dMessTime,
1355 dWinBeg, dWinEnd,
1356 dMessTime - dWinBeg, dWinEnd - dMessTime )
1357 << ( dWinBeg < dMessTime && dMessTime < dWinEnd ? " IN" : "" );
1358*/
1359
1361 if (fbMonitorMode) {
1362 fvhHitsTimeToTriggerRaw[uGdpb]->Fill(dMessTime
1363 - gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs());
1364 if (fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[uGdpb]).getMessageType()) {
1365 UInt_t uTot = (*itMessStart[uGdpb]).getGdpbHit32Tot();
1366 Double_t dTimeDiff = dMessTime - gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs();
1367 if (fuMinTotPulser < uTot && uTot < fuMaxTotPulser && TMath::Abs(dTimeDiff) < 20e3)
1368 fvhHitsTimeToTriggerRawPulser[uGdpb]->Fill(dTimeDiff, uTot);
1369 } // if( fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[ uGdpb ]).getMessageType() )
1370 } // if( fbMonitorMode )
1371
1372
1374 if (dWinBeg < dMessTime && dMessTime < dWinEnd) {
1375 starSubEvent.AddMsg((*itMessStart[uGdpb]));
1377 if (fbMonitorMode) {
1378 fvhHitsTimeToTriggerSel[uGdpb]->Fill(
1379 dMessTime - gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs());
1380 if (fbDebugMonitorMode) {
1381 fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Fill(
1382 dMessTime - gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs(), usFirstStarDaqCmd);
1383 fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Fill(
1384 dMessTime - gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs(), usFirstStarTrigCmd);
1385 } // if( fbDebugMonitorMode )
1386 } // if( fbMonitorMode )
1387 } // if( dWinBeg < dMessTime && dMessTime < dWinEnd )
1388
1390 if (dMessTime < dDeadEnd) ++itFirstMessOutOfDeadtime;
1391
1392 ++itMessStart[uGdpb];
1393 } // while( not at buffer end && (not out of deadtime || not out of trigg win ) )
1394 itMessStart[uGdpb] = itFirstMessOutOfDeadtime;
1395
1397 ++itTrigger[uGdpb];
1398 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1399
1401 dMeanTriggerGdpbTs /= fuNrOfGdpbs;
1402 dMeanTriggerStarTs /= fuNrOfGdpbs;
1403 CbmTofStarTrigger2019 meanTrigger(static_cast<ULong64_t>(dMeanTriggerGdpbTs),
1404 static_cast<ULong64_t>(dMeanTriggerStarTs), uFirstStarToken, usFirstStarDaqCmd,
1405 usFirstStarTrigCmd);
1406 starSubEvent.SetTrigger(meanTrigger);
1407
1409 fvEventsBuffer.push_back(starSubEvent);
1410 } // if( kTRUE == bAllSectorsMatch )
1411 else {
1414 std::vector<CbmTofStarTrigger2019>::iterator itEarliestTrigger;
1415 ULong64_t ulEarliestGdpbTs = 0xFFFFFFFFFFFFFFFFUL;
1416 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1417 if (itTrigger[uGdpb] != fvvBufferTriggers[uGdpb].end()
1418 && ((*itTrigger[uGdpb]).GetFullGdpbTs() < ulEarliestGdpbTs
1419 || 0xFFFFFFFFFFFFFFFFUL == (*itTrigger[uGdpb]).GetFullGdpbTs())) {
1420 itEarliestTrigger = itTrigger[uGdpb];
1421 ulEarliestGdpbTs = (*itTrigger[uGdpb]).GetFullGdpbTs();
1422 } // if( not at end of buffer && (*itTrigger[ uGdpb ]).GetFullGdpbTs() < ulEarliestGdpbTs )
1423 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1424 UInt_t uEarliestStarToken = (*itEarliestTrigger).GetStarToken();
1425 UShort_t usEarliestStarDaqCmd = (*itEarliestTrigger).GetStarDaqCmd();
1426 UShort_t usEarliestStarTrigCmd = (*itEarliestTrigger).GetStarTrigCmd();
1427 ULong64_t ulEarliestFullGdpbTs = (*itEarliestTrigger).GetFullGdpbTs();
1428
1430 UInt_t uNrOfMatchedGdpbs = 0;
1431 std::vector<Bool_t> vbMatchingTrigger(fuNrOfGdpbs, kFALSE);
1432 Double_t dMeanTriggerGdpbTs = 0;
1433 Double_t dMeanTriggerStarTs = 0;
1434 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1435 if (itTrigger[uGdpb] != fvvBufferTriggers[uGdpb].end()
1436 && (*itTrigger[uGdpb]).GetStarToken() == uEarliestStarToken
1437 && (*itTrigger[uGdpb]).GetStarDaqCmd() == usEarliestStarDaqCmd
1438 && (*itTrigger[uGdpb]).GetStarTrigCmd() == usEarliestStarTrigCmd) {
1439 uNrOfMatchedGdpbs++;
1440 vbMatchingTrigger[uGdpb] = kTRUE;
1441
1443 Long64_t ilTriggerDt =
1444 static_cast<Long64_t>((*itTrigger[uGdpb]).GetFullGdpbTs()) - static_cast<Long64_t>(ulEarliestFullGdpbTs);
1445 fvhTriggerDt[uGdpb]->Fill(ilTriggerDt);
1446 } // if( fbMonitorMode && fbDebugMonitorMode )
1447
1448 dMeanTriggerGdpbTs += (*itTrigger[uGdpb]).GetFullGdpbTs();
1449 dMeanTriggerStarTs += (*itTrigger[uGdpb]).GetFullStarTs();
1450 } // if matching trigger
1451 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1452
1454 dMeanTriggerGdpbTs /= uNrOfMatchedGdpbs;
1455 dMeanTriggerStarTs /= uNrOfMatchedGdpbs;
1456 CbmTofStarTrigger2019 meanTrigger(static_cast<ULong64_t>(dMeanTriggerGdpbTs),
1457 static_cast<ULong64_t>(dMeanTriggerStarTs), (*itEarliestTrigger).GetStarToken(),
1458 (*itEarliestTrigger).GetStarDaqCmd(), (*itEarliestTrigger).GetStarTrigCmd());
1459
1461 CbmTofStarSubevent2019 starSubEvent;
1462 starSubEvent.SetTrigger(meanTrigger);
1463 starSubEvent.SetIncompleteEventFlag();
1464
1466 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1470 ULong64_t ulTriggerTime = static_cast<ULong64_t>(dMeanTriggerGdpbTs);
1471 if (kTRUE == vbMatchingTrigger[uGdpb]) {
1473 ulTriggerTime = (*itTrigger[uGdpb]).GetFullGdpbTs();
1474
1476 std::vector<gdpbv100::FullMessage> vTrigMess = (*itTrigger[uGdpb]).GetGdpbMessages();
1477 for (std::vector<gdpbv100::FullMessage>::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end();
1478 ++itMess) {
1479 starSubEvent.AddMsg((*itMess));
1480 } // for( std::vector< gdpbv100::FullMessage >::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end(); ++ itMess )
1481 } // if( kTRUE == vbMatchingTrigger[ uGdpb ] )
1482 else if (fbMonitorMode && fbDebugMonitorMode) {
1484 fhMissingTriggersEvolution->Fill(dMeanTriggerGdpbTs / 1e9 / 60.0,
1485 fUnpackPar->GetGdpbToSectorOffset() + uGdpb);
1486 } // else if( fbMonitorMode && fbDebugMonitorMode )
1487
1488 if (fbAddStatusToEvent) {
1493 while (fvSectorStatusPattern[uGdpb].end() != itStatUpdtStart[uGdpb]
1494 && ((*itStatUpdtStart[uGdpb]).first) * gdpbv100::kuCoarseCounterSize <= ulTriggerTime) {
1495 ++itStatUpdtStart[uGdpb];
1496 } // while( not at the end of updates vector AND Update time under trigger time )
1498 if (fvSectorStatusPattern[uGdpb].begin() != itStatUpdtStart[uGdpb]) {
1500 --itStatUpdtStart[uGdpb];
1502 uint16_t usGdpbId = fUnpackPar->GetGdpbId(uGdpb);
1503 for (uint32_t uIdx = 0; uIdx < kuNbMsgPerPattern; ++uIdx)
1504 starSubEvent.AddMsg(CreateStatusMessage(usGdpbId, uIdx, (*itStatUpdtStart[uGdpb])));
1505 } // if( fvSectorStatusPattern[ uGdpb ].begin() != itStatUpdtStart[ uGdpb ] )
1506 } // if( fbAddStatusToEvent )
1507
1509 Double_t dWinBeg = gdpbv100::kdClockCycleSizeNs * ulTriggerTime + fdStarTriggerDelay[uGdpb];
1510 Double_t dWinEnd =
1512 Double_t dDeadEnd = gdpbv100::kdClockCycleSizeNs * ulTriggerTime + fdStarTriggerDeadtime[uGdpb];
1513 Double_t dWinBegErrors = dWinBeg - 2 * gdpbv100::kdEpochInNs;
1514
1516 UInt_t uNbErrorsInEventGdpb = 0;
1517 while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1518 && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinBegErrors) {
1519 ++itErrorMessStart[uGdpb];
1520 } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinBeg - 2 * gdpbv100::kdEpochInNs )
1521 while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1522 && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinEnd) {
1524 if (uNbErrorsInEventGdpb < kuMaxNbErrorsPerGdpbPerEvent) starSubEvent.AddMsg((*itErrorMessStart[uGdpb]));
1525
1526 ++itErrorMessStart[uGdpb];
1527 ++uNbErrorsInEventGdpb;
1528 } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinEnd )
1529
1532 std::vector<gdpbv100::FullMessage>::iterator itFirstMessOutOfDeadtime = itMessStart[uGdpb];
1533 while (
1534 itMessStart[uGdpb] != fvvBufferMessages[uGdpb].end()
1535 && ((*itMessStart[uGdpb]).GetFullTimeNs() < dDeadEnd || (*itMessStart[uGdpb]).GetFullTimeNs() < dWinEnd)) {
1536 Double_t dMessTime = (*itMessStart[uGdpb]).GetFullTimeNs();
1537 /*
1538 if( 5916 == fulCurrentTsIndex )
1539 LOG(info) << Form( "gDPB %2u Miss Mess %12f Start %12f Stop %12f",
1540 uGdpb, dMessTime,
1541 dWinBeg,
1542 dWinEnd )
1543 << ( dWinBeg < dMessTime && dMessTime < dWinEnd ? " IN" : "" );
1544*/
1546 if (fbMonitorMode) {
1547 fvhHitsTimeToTriggerRaw[uGdpb]->Fill(dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime);
1548 if (fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[uGdpb]).getMessageType()) {
1549 UInt_t uTot = (*itMessStart[uGdpb]).getGdpbHit32Tot();
1550 Double_t dTimeDiff = dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime;
1551 if (fuMinTotPulser < uTot && uTot < fuMaxTotPulser && TMath::Abs(dTimeDiff) < 20e3)
1552 fvhHitsTimeToTriggerRawPulser[uGdpb]->Fill(dTimeDiff, uTot);
1553 } // if( fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[ uGdpb ]).getMessageType() )
1554 } // if( fbMonitorMode )
1555
1557 if (dWinBeg < dMessTime && dMessTime < dWinEnd) {
1558 starSubEvent.AddMsg((*itMessStart[uGdpb]));
1560 if (fbMonitorMode) {
1561 fvhHitsTimeToTriggerSel[uGdpb]->Fill(dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime);
1562 if (fbDebugMonitorMode) {
1563 fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Fill(dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime,
1564 usEarliestStarDaqCmd);
1565 fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Fill(dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime,
1566 usEarliestStarTrigCmd);
1567 } // if( fbDebugMonitorMode )
1568 } // if( fbMonitorMode )
1569 } // if( dWinBeg < dMessTime && dMessTime < dWinEnd )
1570
1572 if (dMessTime < dDeadEnd) ++itFirstMessOutOfDeadtime;
1573
1574 ++itMessStart[uGdpb];
1575 } // while( not at buffer end && (not out of deadtime || not out of trigg win ) )
1576 itMessStart[uGdpb] = itFirstMessOutOfDeadtime;
1577
1579 if (kTRUE == vbMatchingTrigger[uGdpb]) ++itTrigger[uGdpb];
1580 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1581
1583 fvEventsBuffer.push_back(starSubEvent);
1584 } // else of if( kTRUE == bAllSectorsMatch )
1585
1587 bAllSectAllTriggDone = kTRUE;
1588 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1590 if (fvvBufferTriggers[uGdpb].end() != itTrigger[uGdpb]) {
1591 bAllSectAllTriggDone = kFALSE;
1592 break;
1593 } // if( fvvBufferTriggers[ uGdpb ].end() != (*itTrigger[ uGdpb ]) )
1594 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1595 } // while( kFALSE == bAllSectAllTriggDone )
1596
1597 return kTRUE;
1598}
1599
1600// -------------------------------------------------------------------------
1601
1603{
1605 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1606 UInt_t uSector = fUnpackPar->GetGdpbToSectorOffset() + uGdpb;
1607 std::string sFolder = Form("sector%2u", uSector);
1608
1609 LOG(info) << "gDPB " << uGdpb << " is " << sFolder;
1610
1611 fvhHitsTimeToTriggerRaw.push_back(new TH1D(Form("hHitsTimeToTriggerRawSect%2u", uSector),
1612 Form("Time to trigger for all neighboring hits in sector %2u; t "
1613 "- Ttrigg [ns]; Hits []",
1614 uSector),
1615 2000, -5000, 5000));
1616
1617 UInt_t uNbBinsDtSel = fdStarTriggerWinSize[uGdpb];
1618 Double_t dMaxDtSel = fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb];
1619 fvhHitsTimeToTriggerSel.push_back(new TH1D(Form("hHitsTimeToTriggerSelSect%2u", uSector),
1620 Form("Time to trigger for all selected hits in sector %2u; t - "
1621 "Ttrigg [ns]; Hits []",
1622 uSector),
1623 uNbBinsDtSel, fdStarTriggerDelay[uGdpb], dMaxDtSel));
1624
1628
1629 if (kTRUE == fbDebugMonitorMode) {
1631 new TH2D(Form("hHitsTimeToTriggerRawPulserSect%2u", uSector),
1632 Form("Time to trigger for all neighboring hits within pulser TOT range "
1633 "in sector %2u; t - Ttrigg [ns]; TOT [bins]; Hits []",
1634 uSector),
1635 2000, -5000, 5000, 256, 0, 256));
1636
1637 fvhHitsTimeToTriggerSelVsDaq.push_back(new TH2D(Form("hHitsTimeToTriggerSelVsDaqSect%2u", uSector),
1638 Form("Time to trigger for all selected hits vs DAQ CMD in "
1639 "sector %2u; t - Ttrigg [ns]; DAQ CMD []; Hits []",
1640 uSector),
1641 uNbBinsDtSel, fdStarTriggerDelay[uGdpb], dMaxDtSel, 16, 0., 16.));
1642
1643 fvhHitsTimeToTriggerSelVsTrig.push_back(new TH2D(Form("hHitsTimeToTriggerSelVsTrigSect%2u", uSector),
1644 Form("Time to trigger for all selected hits vs TRIG CMD in "
1645 "sector %2u; t - Ttrigg [ns]; TRIG CMD []; Hits []",
1646 uSector),
1647 uNbBinsDtSel, fdStarTriggerDelay[uGdpb], dMaxDtSel, 16, 0.,
1648 16.));
1649
1650 fvhTriggerDt.push_back(new TH1I(Form("hTriggerDtSect%2u", uSector),
1651 Form("Trigger time difference between sector %2u and the first sector, "
1652 "full events only; Ttrigg%2u - TtriggRef [Clk]; events []",
1653 uSector, uSector),
1654 200, -100, 100));
1655
1658 UInt_t uNbBinsInTs = fdMsSizeInNs * 111 / 1000. / 10.;
1659 UInt_t uNbBinsInMs = fdMsSizeInNs * 20 / 1000. / 10.;
1660
1661 fvhTriggerDistributionInTs.push_back(new TH1I(Form("hTriggerDistInTsSect%2u", uSector),
1662 Form("Trigger distribution inside TS in sector %2u; Time in "
1663 "TS [us]; Trigger [];",
1664 uSector),
1665 uNbBinsInTs, -0.5 - fdMsSizeInNs * 10 / 1000.,
1666 fdMsSizeInNs * 101 / 1000. - 0.5));
1667
1668 fvhTriggerDistributionInMs.push_back(new TH1I(Form("hTriggerDistInMsSect%2u", uSector),
1669 Form("Trigger distribution inside MS in sector %2u; Time in "
1670 "MS [us]; Trigger [];",
1671 uSector),
1672 uNbBinsInMs, -0.5 - fdMsSizeInNs * 10 / 1000.,
1673 fdMsSizeInNs * 10 / 1000. - 0.5));
1674
1675 fvhMessDistributionInMs.push_back(new TH1I(Form("hMessDistInMsSect%2u", uSector),
1676 Form("Messages distribution inside MS in sector %2u; Time in "
1677 "MS [us]; Trigger [];",
1678 uSector),
1679 uNbBinsInMs, -0.5 - fdMsSizeInNs * 10 / 1000.,
1680 fdMsSizeInNs * 10 / 1000. - 0.5));
1681
1686 AddHistoToVector(fvhTriggerDt[uGdpb], sFolder);
1690 } // if( kTRUE == fbDebugMonitorMode )
1691 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1692
1694 fhEventNbPerTs = new TH1I("hEventNbPerTs", "Number of Events per TS; Events []; TS []", 1000, 0, 1000);
1695
1697 new TH1I("hEventSizeDistribution", "Event size distribution; Event size [byte]; Events []",
1699
1700 fhEventSizeEvolution = new TProfile(
1701 "hEventSizeEvolution", "Event size evolution; Time in run [min]; mean Event size [byte];", 14400, 0, 14400);
1702
1704 new TH1I("hEventNbEvolution", "Event number evolution; Time in run [min]; Events [];", 14400, 0, 14400);
1705
1707 AddHistoToVector(fhEventNbPerTs, "eventbuilder");
1709 AddHistoToVector(fhEventSizeEvolution, "eventbuilder");
1710 AddHistoToVector(fhEventNbEvolution, "eventbuilder");
1711
1712 if (kTRUE == fbDebugMonitorMode) {
1715 UInt_t uNbBinsInTs = fdMsSizeInNs * 101 / 1000. / 10.;
1716
1718 new TH1I("hEventNbDistributionInTs", "Event number distribution inside TS; Time in TS [us]; Events [];",
1719 uNbBinsInTs, -0.5, fdMsSizeInNs * 101 / 1000. - 0.5);
1720
1721 fhEventSizeDistributionInTs = new TProfile("hEventSizeDistributionInTs",
1722 "Event size distribution inside TS; Time in TS [us]; mean "
1723 "Event size [Byte];",
1724 uNbBinsInTs, -0.5, fdMsSizeInNs * 101 / 1000. - 0.5);
1725
1726 fhRawTriggersStats = new TH2I("hRawTriggersStats", "Raw triggers statistics per sector; ; Sector []; Messages []",
1727 5, 0, 5, 12, 13, 25);
1728 fhRawTriggersStats->GetXaxis()->SetBinLabel(1, "A");
1729 fhRawTriggersStats->GetXaxis()->SetBinLabel(2, "B");
1730 fhRawTriggersStats->GetXaxis()->SetBinLabel(3, "C");
1731 fhRawTriggersStats->GetXaxis()->SetBinLabel(4, "D");
1732 fhRawTriggersStats->GetXaxis()->SetBinLabel(5, "F");
1733
1735 new TH2I("hRawTriggersStatsCore", "Raw triggers in Core MS statistics per sector; ; Sector []; Messages []", 5, 0,
1736 5, 12, 13, 25);
1737 fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(1, "A");
1738 fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(2, "B");
1739 fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(3, "C");
1740 fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(4, "D");
1741 fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(5, "F");
1742
1743 fhRawTriggersStatsOver = new TH2I("hRawTriggersStatsOver",
1744 "Raw triggers in Overlap MS statistics "
1745 "per sector; ; Sector []; Messages []",
1746 5, 0, 5, 12, 13, 25);
1747 fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(1, "A");
1748 fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(2, "B");
1749 fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(3, "C");
1750 fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(4, "D");
1751 fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(5, "F");
1752
1753 fhRawTriggersStatsSel = new TH2I(
1754 "hRawTriggersStatsSel", "Selected triggers statistics per sector; ; Sector []; Messages []", 3, 0, 3, 12, 13, 25);
1755 fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(1, "All");
1756 fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(2, "Core");
1757 fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(3, "Over");
1758
1759 fhMissingTriggersEvolution = new TH2I("hMissingTriggersEvolution",
1760 "Missing trigger counts per sector vs time in run; Time in run "
1761 "[min]; Sector []; Missing triggers []",
1762 14400, 0, 14400, 12, 13, 25);
1763
1767 AddHistoToVector(fhRawTriggersStats, "eventbuilder");
1770 AddHistoToVector(fhRawTriggersStatsSel, "eventbuilder");
1772 } // if( kTRUE == fbDebugMonitorMode )
1773
1775 Double_t w = 10;
1776 Double_t h = 10;
1777
1779 fcTimeToTrigRaw = new TCanvas("cTimeToTrigRaw", "Raw Time to trig for all sectors", w, h);
1780 fcTimeToTrigRaw->Divide(2, fuNrOfGdpbs / 2);
1781 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1782 fcTimeToTrigRaw->cd(1 + uGdpb);
1783 gPad->SetGridx();
1784 gPad->SetGridy();
1785 gPad->SetLogy();
1786 fvhHitsTimeToTriggerRaw[uGdpb]->Draw();
1787 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1789
1791 fcTimeToTrigSel = new TCanvas("cTimeToTrigSel", "Selected Time to trig for all sectors", w, h);
1792 fcTimeToTrigSel->Divide(2, fuNrOfGdpbs / 2);
1793 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1794 fcTimeToTrigSel->cd(1 + uGdpb);
1795 gPad->SetGridx();
1796 gPad->SetGridy();
1797 gPad->SetLogy();
1798 fvhHitsTimeToTriggerSel[uGdpb]->Draw();
1799 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1801
1802 if (kTRUE == fbDebugMonitorMode) {
1804 fcTrigDistMs = new TCanvas("cTrigDistMs", "Trigger time to MS start for all sectors", w, h);
1805 fcTrigDistMs->Divide(2, fuNrOfGdpbs / 2);
1806 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1807 fcTrigDistMs->cd(1 + uGdpb);
1808 gPad->SetGridx();
1809 gPad->SetGridy();
1810 gPad->SetLogy();
1811 fvhTriggerDistributionInMs[uGdpb]->Draw();
1812 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1813 AddCanvasToVector(fcTrigDistMs, "canvases");
1814
1816 fcMessDistMs = new TCanvas("cMessDistMs", "Message time to MS start for all sectors", w, h);
1817 fcMessDistMs->Divide(2, fuNrOfGdpbs / 2);
1818 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1819 fcMessDistMs->cd(1 + uGdpb);
1820 gPad->SetGridx();
1821 gPad->SetGridy();
1822 gPad->SetLogy();
1823 fvhMessDistributionInMs[uGdpb]->Draw();
1824 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1825 AddCanvasToVector(fcMessDistMs, "canvases");
1826
1827 fcTriggerStats = new TCanvas("cTriggerStats", "Trigger statistics per sector", w, h);
1828 fcTriggerStats->Divide(2, 2);
1829
1830 fcTriggerStats->cd(1);
1831 gPad->SetGridx();
1832 gPad->SetGridy();
1833 gPad->SetLogz();
1834 fhRawTriggersStats->Draw("colz text");
1835
1836 fcTriggerStats->cd(2);
1837 gPad->SetGridx();
1838 gPad->SetGridy();
1839 gPad->SetLogz();
1840 fhRawTriggersStatsCore->Draw("colz text");
1841
1842 fcTriggerStats->cd(3);
1843 gPad->SetGridx();
1844 gPad->SetGridy();
1845 gPad->SetLogz();
1846 fhRawTriggersStatsOver->Draw("colz text");
1847
1848 fcTriggerStats->cd(4);
1849 gPad->SetGridx();
1850 gPad->SetGridy();
1851 gPad->SetLogz();
1852 fhRawTriggersStatsSel->Draw("colz text");
1853
1854 AddCanvasToVector(fcTriggerStats, "canvases");
1855 } // if( kTRUE == fbDebugMonitorMode )
1856
1858 fcEventBuildStats = new TCanvas("cEvtBuildStats", "Event building statistics", w, h);
1859 if (kTRUE == fbDebugMonitorMode) fcEventBuildStats->Divide(2, 3);
1860 else
1861 fcEventBuildStats->Divide(2, 2);
1862
1863 fcEventBuildStats->cd(1);
1864 gPad->SetGridx();
1865 gPad->SetGridy();
1866 gPad->SetLogy();
1867 fhEventNbPerTs->Draw();
1868
1869 fcEventBuildStats->cd(2);
1870 gPad->SetGridx();
1871 gPad->SetGridy();
1872 gPad->SetLogy();
1874
1875 fcEventBuildStats->cd(3);
1876 gPad->SetGridx();
1877 gPad->SetGridy();
1878 gPad->SetLogy();
1879 fhEventSizeEvolution->Draw();
1880
1881 fcEventBuildStats->cd(4);
1882 gPad->SetGridx();
1883 gPad->SetGridy();
1884 gPad->SetLogy();
1885 fhEventNbEvolution->Draw();
1886
1887 if (kTRUE == fbDebugMonitorMode) {
1888 fcEventBuildStats->cd(5);
1889 gPad->SetGridx();
1890 gPad->SetGridy();
1891 gPad->SetLogy();
1893
1894 fcEventBuildStats->cd(6);
1895 gPad->SetGridx();
1896 gPad->SetGridy();
1897 gPad->SetLogy();
1899 } // if( kTRUE == fbDebugMonitorMode )
1900
1902
1903 return kTRUE;
1904}
1906{
1907 UInt_t uNbEvents = fvEventsBuffer.size();
1908 fhEventNbPerTs->Fill(uNbEvents);
1909
1910 for (UInt_t uEvent = 0; uEvent < uNbEvents; ++uEvent) {
1911 UInt_t uEventSize = fvEventsBuffer[uEvent].GetEventSize();
1912 Double_t dEventTimeSec = fvEventsBuffer[uEvent].GetEventTimeSec();
1913 Double_t dEventTimeMin = dEventTimeSec / 60.0;
1914
1915 fhEventSizeDistribution->Fill(uEventSize);
1916 if (fbDebugMonitorMode) fhEventSizeEvolution->Fill(dEventTimeSec, uEventSize);
1917 else
1918 fhEventSizeEvolution->Fill(dEventTimeMin, uEventSize);
1919 if (fbDebugMonitorMode) fhEventNbEvolution->Fill(dEventTimeSec);
1920 else
1921 fhEventNbEvolution->Fill(dEventTimeMin);
1922
1923 if (kTRUE == fbDebugMonitorMode) {
1924 Double_t dEventTimeInTs =
1925 (fvEventsBuffer[uEvent].GetTrigger().GetFullGdpbTs() * gdpbv100::kdClockCycleSizeNs - fdTsStartTime) / 1000.0;
1926
1927 fhEventNbDistributionInTs->Fill(dEventTimeInTs);
1928 fhEventSizeDistributionInTs->Fill(dEventTimeInTs, uEventSize);
1929 } // if( kTRUE == fbDebugMonitorMode )
1930 } // for( UInt_t uEvent = 0; uEvent < uNbEvents; ++uEvent )
1931
1932 return kTRUE;
1933}
1935{
1936 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1937 fvhHitsTimeToTriggerRaw[uGdpb]->Reset();
1938 fvhHitsTimeToTriggerSel[uGdpb]->Reset();
1939
1940 if (kTRUE == fbDebugMonitorMode) {
1941 fvhHitsTimeToTriggerRawPulser[uGdpb]->Reset();
1942 fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Reset();
1943 fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Reset();
1944 fvhTriggerDt[uGdpb]->Reset();
1945 fvhTriggerDistributionInTs[uGdpb]->Reset();
1946 fvhTriggerDistributionInMs[uGdpb]->Reset();
1947 fvhMessDistributionInMs[uGdpb]->Reset();
1948 } // if( kTRUE == fbDebugMonitorMode )
1949 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1950
1952 fhEventNbPerTs->Reset();
1953 fhEventSizeDistribution->Reset();
1954 fhEventSizeEvolution->Reset();
1955 fhEventNbEvolution->Reset();
1956
1957 if (kTRUE == fbDebugMonitorMode) {
1960 fhRawTriggersStats->Reset();
1961 fhRawTriggersStatsCore->Reset();
1962 fhRawTriggersStatsOver->Reset();
1963 fhRawTriggersStatsSel->Reset();
1965 } // if( kTRUE == fbDebugMonitorMode )
1966
1967 return kTRUE;
1968}
1969// -------------------------------------------------------------------------
Histogram manager.
static Int_t iWarnMess
static constexpr size_t size()
Definition KfSimdPseudo.h:2
bool first
int Int_t
bool Bool_t
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< size_t > fvMsComponentsList
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
std::vector< ULong64_t > fvulStarTsMsb
[sector]
std::vector< std::vector< std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb > > > > fvSectorStatusPattern
[sector][asic] Exclude from dictionnary
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsDaq
[sector]
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastResyncPattern
[sector][asic] Exclude from dictionnary
std::vector< UInt_t > fvuStarDaqCmdLast
[sector]
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
std::vector< UInt_t > fvuStarTokenLastCore
[sector]
std::vector< ULong64_t > fvulGdpbTsFullLastCore
[sector]
std::vector< UInt_t > fvuStarTrigCmdLastCore
[sector]
std::vector< TH1 * > fvhHitsTimeToTriggerSel
[sector], extra monitor for debug
void ProcessSlCtrl(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
std::vector< TH1 * > fvhTriggerDistributionInMs
[sector], extra monitor for debug
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMessages
[sector], buffer to make sure GET4 errors 0-12 are always transmitted
std::vector< TH1 * > fvhTriggerDt
[sector], extra monitor for debug
std::vector< TH1 * > fvhHitsTimeToTriggerRaw
[sector][Update]<time, [asic]> Exclude from dictionnary
std::vector< std::vector< gdpbv100::Message > > fvvmEpSupprBuffer
Epoch + Epoch Cycle.
Bool_t fbAddStatusToEvent
Switch ON the insertion of the LostEvent messages from GET4s with the critical errors (default is fal...
std::vector< ULong64_t > fvulStarTsFullLastCore
[sector]
gdpbv100::FullMessage CreateStatusMessage(uint16_t uGdpbId, uint32_t uIndex, std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb > > statusIn)
std::vector< Double_t > fdStarTriggerDelay
[sector]
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
TCanvas * fcMessDistMs
All sectors, extra monitor for debug.
TH2 * fhRawTriggersStatsCore
extra monitor for debug
std::vector< TH1 * > fvhTriggerDistributionInTs
[sector], extra monitor for debug
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMajorAsicErrors
[sector]
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastEnablePattern
[sector][asic] Exclude from dictionnary
std::vector< ULong64_t > fvulStarTsFullLast
[sector]
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsTrig
[sector], extra monitor for debug
std::vector< Double_t > fvdTrigCandidateTimeStart
[sector]
TCanvas * fcEventBuildStats
All sectors, extra monitor for debug.
std::vector< Double_t > fvdMessCandidateTimeStart
[sector]
TH2 * fhRawTriggersStatsOver
extra monitor for debug
Bool_t fbStoreLostEventMsg
Switch ON the filling of a additional set of histograms.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void StoreMessageInBuffer(gdpbv100::FullMessage fullMess, uint32_t uGdpbNr)
std::vector< std::vector< CbmTofStarTrigger2019 > > fvvBufferTriggers
[sector]
void ProcessEpochCycle(uint64_t ulCycleData)
All sectors, extra monitor for debug.
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastMissmatchPattern
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
void ProcessSysMess(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
void ProcessHit(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
std::vector< ULong64_t > fvulGdpbTsFullLast
[sector]
void ProcessPattern(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< TH2 * > fvhHitsTimeToTriggerRawPulser
[sector]
TProfile * fhEventSizeDistributionInTs
extra monitor for debug
std::vector< Double_t > fvdMessCandidateTimeStop
[sector]
std::vector< ULong64_t > fvulGdpbTsLsb
[sector]
TH1 * fhEventNbPerTs
[sector], extra monitor for debug
std::vector< Double_t > fvdTrigCandidateTimeStop
[sector]
std::vector< UInt_t > fvuStarTrigCmdLast
[sector]
std::vector< TH1 * > fvhMessDistributionInMs
[sector], extra monitor for debug
TH2 * fhMissingTriggersEvolution
extra monitor for debug
Double_t fdAllowedTriggersSpread
Event window limits.
std::vector< Double_t > fdStarTriggerWinSize
[sector]
static const UInt_t kuMaxNbErrorsPerGdpbPerEvent
Switch ON the readout and insertion of STATUS pattern message (default is true)
std::vector< CbmTofStarSubevent2019 > fvEventsBuffer
[sector]
std::vector< ULong64_t > fvulCurrentEpoch
Current time references for each GDPB: merged epoch marker, epoch cycle, full epoch [fuNrOfGdpbs].
TH2 * fhRawTriggersStatsSel
extra monitor for debug
TCanvas * fcTimeToTrigRaw
extra monitor for debug
CbmStar2019TofPar * fUnpackPar
Correspond to ~6000 error messages max per event, leaving 2000 for hits and epoch.
static const uint32_t kuNbMsgPerPattern
ASIC status monitoring.
std::vector< ULong64_t > fvulStarTsMid
[sector]
std::vector< UInt_t > fvuStarDaqCmdLastCore
[sector]
Data class with information on a STS local track.
void SetTrigger(CbmTofStarTrigger2019 triggerIn)
void SetIncompleteEventFlag(Bool_t bFlagState=kTRUE)
void AddMsg(const gdpbv100::FullMessage &msgIn)
static uint32_t GetMaxOutputSize()
ULong64_t GetFullGdpbTs() const
double GetFullTimeNs() const
uint16_t getGdpbHitIs24b() const
uint16_t getStarTrigMsgIndex() const
uint32_t getGdpbEpEpochNb() const
uint16_t getGdpbSysPattType() const
uint64_t getStarTsMidStarC() const
uint16_t getGdpbSysSubType() const
uint64_t getGdpbTsLsbStarB() const
void setGdpbSysPattType(uint16_t v)
uint16_t getGdpbSysPattIndex() const
void setGdpbEpEpochNb(uint32_t v)
uint64_t getStarTsMsbStarB() const
uint32_t getStarTrigCmdStarD() const
uint32_t getGdpbSysPattPattern() const
bool isStarTrigger() const
Returns true is message type is MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message)
uint32_t getStarDaqCmdStarD() const
void setGdpbSysPattPattern(uint32_t v)
void setMessageType(uint8_t v)
Sets the message type field in the current message.
uint64_t getGdpbTsMsbStarA() const
uint16_t getGdpbGenChipId() const
uint16_t getGdpbSysErrUnused() const
void setGdpbSysPattIndex(uint16_t v)
uint32_t getStarTokenStarD() const
void setGdpbGenGdpbId(uint32_t v)
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
void setGdpbSysSubType(uint16_t v)
uint16_t getGdpbHitChanId() const
const double kdClockCycleSizeNs
@ GET4_V2X_ERR_LOST_EVT
@ GET4_V2X_ERR_TOT_RANGE
@ GET4_V2X_ERR_ADD_RIS_EDG
@ GET4_V2X_ERR_TOT_OVERWRT
@ GET4_V2X_ERR_EVT_DISCARD
@ GET4_V2X_ERR_UNPAIR_FALL
@ GET4_V2X_ERR_SEQUENCE_ER
const uint32_t kuChipIdMergedEpoch
const uint32_t kuEpochCounterSz
const double kdEpochInNs
const uint64_t kulEpochCycleFieldSz
const uint32_t kuCoarseCounterSize
@ SYS_GET4_SYNC_MISS