CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorAlgoBmon.cxx
Go to the documentation of this file.
1/* Copyright (C) 2019-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// ----- CbmMcbm2018MonitorAlgoBmon -----
8// ----- Created 10.02.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
14#include "CbmFlesHistosTools.h"
16#include "CbmMcbm2018TofPar.h"
17#include "CbmTofAddress.h"
18#include "CbmTofDetectorId_v14a.h" // in cbmdata/tof
19#include "FairRootManager.h"
20#include "FairRun.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
23#include "TCanvas.h"
24#include "TH1.h"
25#include "TH2.h"
26#include "TList.h"
27#include "TPaveStats.h"
28#include "TProfile.h"
29#include "TROOT.h"
30#include "TString.h"
31
32#include <Logger.h>
33
34#include <cstdint>
35#include <fstream>
36#include <iomanip>
37#include <iostream>
38
39// -------------------------------------------------------------------------
42{
44 fvmHitsInMs.clear();
45 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
46 // fvmHitsInMs[ uDpb ].clear();
47 fvvmEpSupprBuffer[uGdpb].clear();
48 } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
49}
50
51// -------------------------------------------------------------------------
53{
54 LOG(info) << "Initializing mCBM Bmon 2019 monitor algo";
55
56 return kTRUE;
57}
65
66// -------------------------------------------------------------------------
68{
69 LOG(info) << "Init parameter containers for CbmMcbm2018MonitorAlgoBmon";
70 Bool_t initOK = ReInitContainers();
71
72 return initOK;
73}
75{
76 LOG(info) << "**********************************************";
77 LOG(info) << "ReInit parameter containers for CbmMcbm2018MonitorAlgoBmon";
78
79 fUnpackPar = (CbmMcbm2018TofPar*) fParCList->FindObject("CbmMcbm2018TofPar");
80 if (nullptr == fUnpackPar) return kFALSE;
81
82 Bool_t initOK = InitParameters();
83
84 return initOK;
85}
87{
88 if (nullptr == fParCList) fParCList = new TList();
89 fUnpackPar = new CbmMcbm2018TofPar("CbmMcbm2018TofPar");
91
92 return fParCList;
93}
95{
96
97 fuNrOfGdpbs = fUnpackPar->GetNrOfGdpbs();
98 LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
99
100 fuNrOfFeePerGdpb = fUnpackPar->GetNrOfFeesPerGdpb();
101 LOG(info) << "Nr. of FEES per Tof GDPB: " << fuNrOfFeePerGdpb;
102
103 fuNrOfGet4PerFee = fUnpackPar->GetNrOfGet4PerFee();
104 LOG(info) << "Nr. of GET4 per Tof FEE: " << fuNrOfGet4PerFee;
105
106 fuNrOfChannelsPerGet4 = fUnpackPar->GetNrOfChannelsPerGet4();
107 LOG(info) << "Nr. of channels per GET4: " << fuNrOfChannelsPerGet4;
108
110 LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
111
113 LOG(info) << "Nr. of GET4s: " << fuNrOfGet4;
114
116 LOG(info) << "Nr. of GET4s per GDPB: " << fuNrOfGet4PerGdpb;
117
119 LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
120
121 fGdpbIdIndexMap.clear();
122 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
123 fGdpbIdIndexMap[fUnpackPar->GetGdpbId(i)] = i;
124 LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex << fUnpackPar->GetGdpbId(i) << std::dec;
125 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
126
128 fvulCurrentEpoch.resize(fuNrOfGdpbs, 0);
131
134
135 return kTRUE;
136}
137// -------------------------------------------------------------------------
138
139void CbmMcbm2018MonitorAlgoBmon::AddMsComponentToList(size_t component, UShort_t usDetectorId)
140{
142 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
143 if (component == fvMsComponentsList[uCompIdx]) return;
144
146 fvMsComponentsList.push_back(component);
147
148 LOG(info) << "CbmMcbm2018MonitorAlgoBmon::AddMsComponentToList => Component " << component << " with detector ID 0x"
149 << std::hex << usDetectorId << std::dec << " added to list";
150}
151// -------------------------------------------------------------------------
152
154{
155 fulCurrentTsIdx = ts.index();
156 fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
157
159 if (0 == fulCurrentTsIdx) return kTRUE;
160
162 if (-1.0 == fdTsCoreSizeInNs) {
163 fuNbCoreMsPerTs = ts.num_core_microslices();
164 fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
167 LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs << " Core MS and " << fuNbOverMsPerTs
168 << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs << " ns and a full duration of "
169 << fdTsFullSizeInNs << " ns";
170
174 LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
175 } // if( -1.0 == fdTsCoreSizeInNs )
176
179 // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIdx, fdTsStartTime, fdTsStopTimeCore );
180
182 for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
184 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
185 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
186
187 if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
188 LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS " << fuMsIndex << " for component " << uMsComp;
189 return kFALSE;
190 } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
191 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
192 /*
194 std::sort( fvmHitsInMs.begin(), fvmHitsInMs.end() );
195
197 for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
198 {
199 UInt_t uFebIdx = itHitIn->GetAsic() / fUnpackPar->GetNbAsicsPerFeb()
200 + ( itHitIn->GetDpb() * fUnpackPar->GetNbCrobsPerDpb() + itHitIn->GetCrob() )
201 * fUnpackPar->GetNbFebsPerCrob();
202 UInt_t uChanInFeb = itHitIn->GetChan()
203 + fUnpackPar->GetNbChanPerAsic() * (itHitIn->GetAsic() % fUnpackPar->GetNbAsicsPerFeb());
204
205 ULong64_t ulTimeInNs = static_cast< ULong64_t >( itHitIn->GetTs() * stsxyter::kdClockCycleNs - fdTimeOffsetNs );
206
207 fDigiVect.push_back( CbmTofDigi( fviFebAddress[ uFebIdx ], uChanInFeb, ulTimeInNs, itHitIn->GetAdc() ) );
208 } // for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
209*/
211 fvmHitsInMs.clear();
212 } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
213
215 fvmHitsInMs.clear();
216 /*
217 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
218 {
219 fvmHitsInMs[ uDpb ].clear();
220 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
221*/
223 if (fbMonitorMode) {
224 if (kFALSE == FillHistograms()) {
225 LOG(error) << "Failed to fill histos in ts " << fulCurrentTsIdx;
226 return kFALSE;
227 } // if( kFALSE == FillHistograms() )
228 } // if( fbMonitorMode )
229
230 return kTRUE;
231}
232
233Bool_t CbmMcbm2018MonitorAlgoBmon::ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx)
234{
235 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
236 fuCurrentEquipmentId = msDescriptor.eq_id;
237 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
238
239 uint32_t uSize = msDescriptor.size;
240 fulCurrentMsIdx = msDescriptor.idx;
241 fdMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
242 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
243 << " has size: " << uSize;
244
245 if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts.num_components(), kFALSE);
246
247 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
248 // fuCurrDpbIdx = fDpbIdIndexMap[ fuCurrDpbId ];
249
250 /*
251 * Should be only for first detected TS
252 */
253 if (fulCurrentTsIdx < 10 && 0 == uMsIdx) {
254 LOG(info) << "---------------------------------------------------------------";
255 LOG(info) << "Component " << uMsCompIdx << " TS Idx " << fulCurrentTsIdx;
256 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
257 LOG(info) << Form("%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx",
258 static_cast<unsigned int>(msDescriptor.hdr_id), static_cast<unsigned int>(msDescriptor.hdr_ver),
259 msDescriptor.eq_id, msDescriptor.flags, static_cast<unsigned int>(msDescriptor.sys_id),
260 static_cast<unsigned int>(msDescriptor.sys_ver), static_cast<unsigned long>(msDescriptor.idx),
261 msDescriptor.crc, msDescriptor.size, static_cast<unsigned long>(msDescriptor.offset));
262 } // if( fulCurrentTsIdx < 10 && 0 == uMsIdx )
263 /*
264*/
265
267 auto it = fGdpbIdIndexMap.find(fuCurrDpbId);
268 if (it == fGdpbIdIndexMap.end()) {
269 if (kFALSE == fvbMaskedComponents[uMsCompIdx]) {
270 LOG(info) << "---------------------------------------------------------------";
271 /*
272 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
273 LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
274 static_cast<unsigned int>(msDescriptor.hdr_id),
275 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
276 static_cast<unsigned int>(msDescriptor.sys_id),
277 static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
278 msDescriptor.size, msDescriptor.offset );
279*/
280 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
281 LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex << fuCurrDpbId << std::dec
282 << " in timeslice " << fulCurrentTsIdx << " in microslice " << uMsIdx << " component " << uMsCompIdx
283 << "\n"
284 << "If valid this index has to be added in the TOF "
285 "parameter file in the DbpIdArray field";
286 fvbMaskedComponents[uMsCompIdx] = kTRUE;
287 } // if( kFALSE == fvbMaskedComponents[ uMsComp ] )
288 else
289 return kTRUE;
290
293
294 return kFALSE;
295 } // if( it == fGdpbIdIndexMap.end() )
296 else
298
300 if (0 == fuCurrDpbIdx) {
306 fbSpillOn = kFALSE;
312 } // if( fbSpillOn && fuCountsLastInter < fuOffSpillCountLimit && same for non pulser)
314 fbSpillOn = kTRUE;
315
316 LOG(debug) << Form("%6llu %6.4f %9u %9u %2d", fulCurrentTsIdx, fdMsTime - fdLastInterTime, fuCountsLastInter,
318
322 } // if( fdSpillCheckInterval < fdMsTime - fdLastInterTime )
323 } // if( 0 == fuCurrDpbIdx )
324
331 } // else if( fuHistoryHistoSize < fdMsTime - fdStartTime )
332
333 // If not integer number of message in input buffer, print warning/error
334 if (0 != (uSize % kuBytesPerMessage))
335 LOG(error) << "The input microslice buffer does NOT "
336 << "contain only complete nDPB messages!";
337
338 // Compute the number of complete messages in the input microslice buffer
339 uint32_t uNbMessages = (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
340
341 // Prepare variables for the loop on contents
342 Int_t messageType = -111;
343 const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
344 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
345 // Fill message
346 uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]);
347
349 if (0 == uIdx) {
350 // ProcessEpochCycle( ulData );
351 continue;
352 } // if( 0 == uIdx )
353
354 gdpbv100::Message mess(ulData);
356 messageType = mess.getMessageType();
357
358 fuGet4Id = mess.getGdpbGenChipId();
359 ;
361 // UInt_t uChannelBmon = ( fuGet4Id < 32 ) ? ( fuGet4Id / 8 ) : (fuGet4Id / 8 - 1); /// December 2018 mapping
362 UInt_t uChannelBmon = fuGet4Id / 2 + 4 * fuCurrDpbIdx;
363
365 LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS " << fuNrOfGet4PerGdpb
366 << " set in parameters.";
367
368 switch (messageType) {
369 case gdpbv100::MSG_HIT: {
370 if (mess.getGdpbHitIs24b()) {
371 LOG(error) << "This event builder does not support 24b hit message!!!.";
372 continue;
373 } // if( getGdpbHitIs24b() )
374 else {
377
380 fvhErrorFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 0.0);
381 fvhEvtLostFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 0.0);
382
385
386 fvhHitCntEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime);
387
388 fvuHitCntChanMs[uChannelBmon]++;
389
391 UInt_t uTot = mess.getGdpbHit32Tot();
392 if (uTot < fuMinTotPulser || fuMaxTotPulser < uTot) {
394
395 fhDpbMap->Fill(fuCurrDpbIdx);
396 fhChannelMap->Fill(uChannelBmon);
397 fhChanHitMap->Fill(fuDiamChanMap[uChannelBmon]);
398
402 } // if( uTot < fuMinTotPulser || fuMaxTotPulser < uTot )
403 else {
404 fhChannelMapPulser->Fill(uChannelBmon);
405 fhHitMapEvoPulser->Fill(uChannelBmon, fdMsTime - fdStartTime);
406 } // else of if( uTot < fuMinTotPulser || fuMaxTotPulser < uTot )
407 fhHitMapEvo->Fill(uChannelBmon, fdMsTime - fdStartTime);
408 fhHitTotEvo->Fill(fdMsTime - fdStartTime, uTot);
409 fhChanHitMapEvo->Fill(fuDiamChanMap[uChannelBmon], fdMsTime - fdStartTime);
410 // fvvmEpSupprBuffer[fuCurrDpbIdx].push_back( mess );
411 } // else of if( getGdpbHitIs24b() )
412 break;
413 } // case gdpbv100::MSG_HIT:
414 case gdpbv100::MSG_EPOCH: {
415 /*
416 if( gdpbv100::kuChipIdMergedEpoch == fuGet4Id )
417 {
418 ProcessEpoch(mess);
419 } // if this epoch message is a merged one valid for all chips
420 else
421 {
423 LOG(debug2) << "This event builder does not support unmerged epoch messages!!!.";
424 continue;
425 } // if single chip epoch message
426*/
427 break;
428 } // case gdpbv100::MSG_EPOCH:
429 case gdpbv100::MSG_SLOWC: {
430 // fvvmEpSupprBuffer[fuCurrDpbIdx].push_back( mess );
431 break;
432 } // case gdpbv100::MSG_SLOWC:
433 case gdpbv100::MSG_SYST: {
437 fvhErrorFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 0.0);
438 fvhEvtLostFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 0.0);
439
443
444 fvhErrorCntEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime);
445 fvhErrorFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 1.0);
446
447 fvuErrorCntChanMs[uChannelBmon]++;
451
452 fvhEvtLostCntEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime);
453 fvhEvtLostFractEvoChan[uChannelBmon]->Fill(fdMsTime - fdStartTime, 1.0);
454
455 fvuEvtLostCntChanMs[uChannelBmon]++;
456 } // if( gdpbv100::GET4_V2X_ERR_LOST_EVT == mess.getGdpbSysErrData() )
457 } // if( gdpbv100::SYS_GET4_ERROR == mess.getGdpbSysSubType() )
458 // fvvmEpSupprBuffer[fuCurrDpbIdx].push_back( mess );
459 break;
460 } // case gdpbv100::MSG_SYST:
465 break;
466 } // case gdpbv100::MSG_STAR_TRI_A-D
467 default:
468 LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
469 << " not included in Get4 unpacker.";
470 } // switch( mess.getMessageType() )
471 } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
472
475
476 return kTRUE;
477}
478/*
479// -------------------------------------------------------------------------
480void CbmMcbm2018MonitorAlgoBmon::ProcessEpochCycle( uint64_t ulCycleData )
481{
482 ULong64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz;
483
484 if( !( ulEpochCycleVal == fvulCurrentEpochCycle[fuCurrDpbIdx] ||
485 ulEpochCycleVal == fvulCurrentEpochCycle[fuCurrDpbIdx] + 1 ) &&
486 0 < fulCurrentMsIdx ) {
487 LOG(warning) << "CbmMcbm2018MonitorAlgoBmon::ProcessEpochCycle => "
488 << " Missmatch in epoch cycles detected for Gdpb " << fuCurrDpbIdx <<", probably fake cycles due to epoch index corruption! "
489 << Form( " Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuCurrDpbIdx], ulEpochCycleVal );
490 } // if epoch cycle did not stay constant or increase by exactly 1, except if first MS of the TS
491 if( ulEpochCycleVal != fvulCurrentEpochCycle[fuCurrDpbIdx] )
492 {
493 LOG(info) << "CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
494 << " New epoch cycle for Gdpb " << fuCurrDpbIdx
495 << Form( ": Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuCurrDpbIdx], ulEpochCycleVal );
496 } // if( ulEpochCycleVal != fvulCurrentEpochCycle[fuCurrDpbIdx] )
497 fvulCurrentEpochCycle[fuCurrDpbIdx] = ulEpochCycleVal;
498
499 return;
500}
501void CbmMcbm2018MonitorAlgoBmon::ProcessEpoch( gdpbv100::Message mess )
502{
503 ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
504
505 fvulCurrentEpoch[ fuCurrDpbIdx ] = ulEpochNr;
506 fvulCurrentEpochFull[ fuCurrDpbIdx ] = ulEpochNr + ( gdpbv100::kuEpochCounterSz + 1 ) * fvulCurrentEpochCycle[ fuCurrDpbIdx ];
507
510 if( 0 < ulEpochNr )
511 mess.setGdpbEpEpochNb( ulEpochNr - 1 );
512 else mess.setGdpbEpEpochNb( gdpbv100::kuEpochCounterSz );
513
515 ProcessEpSupprBuffer();
516}
517// -------------------------------------------------------------------------
518void CbmMcbm2018MonitorAlgoBmon::ProcessEpSupprBuffer()
519{
520 Int_t iBufferSize = fvvmEpSupprBuffer[ fuCurrDpbIdx ].size();
521
522 if( 0 == iBufferSize )
523 return;
524
525 LOG(debug) << "Now processing stored messages for for gDPB " << fuCurrDpbIdx << " with epoch number "
526 << (fvulCurrentEpoch[fuCurrDpbIdx] - 1);
527
530 std::stable_sort( fvvmEpSupprBuffer[ fuCurrDpbIdx ].begin(), fvvmEpSupprBuffer[ fuCurrDpbIdx ].begin() );
531
533 ULong64_t ulCurEpochGdpbGet4 = fvulCurrentEpochFull[ fuCurrDpbIdx ];
534
536 if( 0 == ulCurEpochGdpbGet4 )
537 return;
538
540 ulCurEpochGdpbGet4 --;
541
542 Int_t messageType = -111;
543 for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
544 {
545 messageType = fvvmEpSupprBuffer[ fuCurrDpbIdx ][ iMsgIdx ].getMessageType();
546
547 fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx( fvvmEpSupprBuffer[ fuCurrDpbIdx ][ iMsgIdx ].getGdpbGenChipId() );
548 if( fuDiamondDpbIdx == fuCurrDpbIdx )
549 fuGet4Id = fvvmEpSupprBuffer[ fuCurrDpbIdx ][ iMsgIdx ].getGdpbGenChipId();
550 fuGet4Nr = (fuCurrDpbIdx * fuNrOfGet4PerGdpb) + fuGet4Id;
551
553 gdpbv100::FullMessage fullMess( fvvmEpSupprBuffer[ fuCurrDpbIdx ][ iMsgIdx ], ulCurEpochGdpbGet4 );
554
556 switch( messageType )
557 {
558 case gdpbv100::MSG_HIT:
559 {
560 ProcessHit( fullMess );
561 break;
562 } // case gdpbv100::MSG_HIT:
563 case gdpbv100::MSG_SLOWC:
564 {
565 ProcessSlCtrl( fullMess );
566 break;
567 } // case gdpbv100::MSG_SLOWC:
568 case gdpbv100::MSG_SYST:
569 {
570 ProcessSysMess( fullMess );
571 break;
572 } // case gdpbv100::MSG_SYST:
573 case gdpbv100::MSG_EPOCH:
574 case gdpbv100::MSG_STAR_TRI_A:
575 case gdpbv100::MSG_STAR_TRI_B:
576 case gdpbv100::MSG_STAR_TRI_C:
577 case gdpbv100::MSG_STAR_TRI_D:
579 break;
580 default:
581 LOG(error) << "Message type " << std::hex
582 << std::setw(2) << static_cast<uint16_t>(messageType)
583 << " not included in Get4 unpacker.";
584 } // switch( mess.getMessageType() )
585 } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
586
587 fvvmEpSupprBuffer[ fuCurrDpbIdx ].clear();
588}
589// -------------------------------------------------------------------------
590void CbmMcbm2018MonitorAlgoBmon::ProcessHit( gdpbv100::FullMessage mess )
591{
592 UInt_t uChannel = mess.getGdpbHitChanId();
593 UInt_t uTot = mess.getGdpbHit32Tot();
594
595 // In 32b mode the coarse counter is already computed back to 112 FTS bins
596 // => need to hide its contribution from the Finetime
597 // => FTS = Fullt TS modulo 112
598 UInt_t uFts = mess.getGdpbHitFullTs() % 112;
599
600 UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
601 UInt_t uChannelNrInFee = (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel;
602 UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
603 UInt_t uFeeNrInSys = fuCurrDpbIdx * fuNrOfFeePerGdpb + uFeeNr;
604 UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + fUnpackPar->Get4ChanToPadiChan( uChannelNrInFee );
605 UInt_t uGbtxNr = (uFeeNr / fUnpackPar->GetNrOfFeePerGbtx());
606 UInt_t uFeeInGbtx = (uFeeNr % fUnpackPar->GetNrOfFeePerGbtx());
607 UInt_t uGbtxNrInSys = fuCurrDpbIdx * fUnpackPar->GetNrOfGbtxPerGdpb() + uGbtxNr;
608
609 UInt_t uChanInSyst = fuCurrDpbIdx * fuNrOfChannelsPerGdpb + uChannelNr;
610 UInt_t uRemappedChannelNrInSys = fuCurrDpbIdx * fuNrOfChannelsPerGdpb
611 + uFeeNr * fuNrOfChannelsPerFee
612 + fUnpackPar->Get4ChanToPadiChan( uChannelNrInFee );
614 if( fuDiamondDpbIdx == fuCurrDpbIdx )
615 {
616 uRemappedChannelNr = uChannelNr;
617 uRemappedChannelNrInSys = fuCurrDpbIdx * fUnpackPar->GetNrOfChannelsPerGdpb() + uChannelNr;
618 } // if( fuDiamondDpbIdx == fuCurrDpbIdx )
619
620 ULong_t ulHitTime = mess.getMsgFullTime( mess.getExtendedEpoch() );
621 Double_t dHitTime = mess.GetFullTimeNs();
622 Double_t dHitTot = uTot; // in bins
623
624}
625// -------------------------------------------------------------------------
626void CbmMcbm2018MonitorAlgoBmon::ProcessSlCtrl( gdpbv100::FullMessage mess )
627{
628}
629// -------------------------------------------------------------------------
630void CbmMcbm2018MonitorAlgoBmon::ProcessSysMess( gdpbv100::FullMessage mess )
631{
632 switch( mess.getGdpbSysSubType() )
633 {
634 case gdpbv100::SYS_GET4_ERROR:
635 {
636 ProcessError( mess );
637 break;
638 } // case gdpbv100::SYSMSG_GET4_EVENT
639 case gdpbv100::SYS_GDPB_UNKWN:
640 {
641 LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8)
642 << mess.getGdpbSysUnkwData() << std::dec
643 <<" Full message: " << std::hex << std::setw(16)
644 << mess.getData() << std::dec;
645 break;
646 } // case gdpbv100::SYS_GDPB_UNKWN:
647 case gdpbv100::SYS_GET4_SYNC_MISS:
648 {
649 if( mess.getGdpbSysFwErrResync() )
650 LOG(info) << Form( "GET4 Resynchronization: Get4:0x%04x ", mess.getGdpbGenChipId() ) << fuCurrDpbIdx;
651 else LOG(info) << "GET4 synchronization pulse missing in gDPB " << fuCurrDpbIdx;
652 break;
653 } // case gdpbv100::SYS_GET4_SYNC_MISS:
654 case gdpbv100::SYS_PATTERN:
655 {
656 ProcessPattern( mess );
657 break;
658 } // case gdpbv100::SYS_PATTERN:
659 default:
660 {
661 LOG(info) << "Crazy system message, subtype " << mess.getGdpbSysSubType();
662 break;
663 } // default
664 } // switch( mess.getGdpbSysSubType() )
665}
666void CbmMcbm2018MonitorAlgoBmon::ProcessError( gdpbv100::FullMessage mess )
667{
668 uint32_t uErrorType = mess.getGdpbSysErrData();
669
670 switch( uErrorType )
671 {
672 case gdpbv100::GET4_V2X_ERR_READ_INIT:
673 case gdpbv100::GET4_V2X_ERR_SYNC:
674 case gdpbv100::GET4_V2X_ERR_EP_CNT_SYNC:
675 case gdpbv100::GET4_V2X_ERR_EP:
676 case gdpbv100::GET4_V2X_ERR_FIFO_WRITE:
677 case gdpbv100::GET4_V2X_ERR_CHAN_STATE:
678 case gdpbv100::GET4_V2X_ERR_TOK_RING_ST:
679 case gdpbv100::GET4_V2X_ERR_TOKEN:
680 case gdpbv100::GET4_V2X_ERR_READOUT_ERR:
681 case gdpbv100::GET4_V2X_ERR_DLL_LOCK:
682 case gdpbv100::GET4_V2X_ERR_DLL_RESET:
684 break;
685 case gdpbv100::GET4_V2X_ERR_SPI:
687 break;
688 case gdpbv100::GET4_V2X_ERR_LOST_EVT:
689 case gdpbv100::GET4_V2X_ERR_TOT_OVERWRT:
690 case gdpbv100::GET4_V2X_ERR_TOT_RANGE:
691 case gdpbv100::GET4_V2X_ERR_EVT_DISCARD:
692 case gdpbv100::GET4_V2X_ERR_ADD_RIS_EDG:
693 case gdpbv100::GET4_V2X_ERR_UNPAIR_FALL:
694 case gdpbv100::GET4_V2X_ERR_SEQUENCE_ER:
696 break;
697 case gdpbv100::GET4_V2X_ERR_EPOCH_OVERF:
698 break;
699 case gdpbv100::GET4_V2X_ERR_UNKNOWN:
701 break;
702 default:
704 break;
705 } // switch( uErrorType )
706
707 return;
708}
709void CbmMcbm2018MonitorAlgoBmon::ProcessPattern( gdpbv100::FullMessage mess )
710{
711 uint16_t usType = mess.getGdpbSysPattType();
712 uint16_t usIndex = mess.getGdpbSysPattIndex();
713 uint32_t uPattern = mess.getGdpbSysPattPattern();
714
715 switch( usType )
716 {
717 case gdpbv100::PATT_MISSMATCH:
718 {
719 LOG(debug) << Form( "Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
720
721 break;
722 } // case gdpbv100::PATT_MISSMATCH:
723 case gdpbv100::PATT_ENABLE:
724 {
725 LOG(debug2) << Form( "Enable pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
726
727 break;
728 } // case gdpbv100::PATT_ENABLE:
729 case gdpbv100::PATT_RESYNC:
730 {
731 LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
732
733 break;
734 } // case gdpbv100::PATT_RESYNC:
735 default:
736 {
737 LOG(debug) << "Crazy pattern message, subtype " << usType;
738 break;
739 } // default
740 } // switch( usType )
741
742 return;
743}
744// -------------------------------------------------------------------------
745*/
747{
748 std::string sFolder = "MoniBmon";
749
750 LOG(info) << "create Histos for Bmon monitoring ";
751
753 uint32_t iNbBinsLog = 0;
755 std::vector<double> dBinsLogVector = GenerateLogBinArray(4, 9, 1, iNbBinsLog);
756 double* dBinsLog = dBinsLogVector.data();
757 // double * dBinsLog = GenerateLogBinArray( 4, 9, 1, iNbBinsLog );
758
759 /*******************************************************************/
760 fhDpbMap =
761 new TH1I("hDpbMap", "Map of hits on Bmon detector; DPB; Hits Count []", fuNrOfGdpbs, -0.5, fuNrOfGdpbs - 0.5);
762 fhChannelMap = new TH1I("hChannelMap", "Map of hits on Bmon detector; Strip; Hits Count []", kuNbChanDiamond, -0.5,
763 kuNbChanDiamond - 0.5);
764 fhHitMapEvo = new TH2I("hHitMapEvo",
765 "Map of hits on Bmon detector vs time in run; Chan; "
766 "Time in run [s]; Hits Count []",
768 fhHitTotEvo = new TH2I("hHitTotEvo",
769 "Evolution of TOT in Bmon detector vs time in run; Time "
770 "in run [s]; TOT [ bin ]; Hits Count []",
771 fuHistoryHistoSize, 0, fuHistoryHistoSize, 256, -0.5, 255.5);
772 fhChanHitMap = new TH1D("fhChanHitMap", "Map of hits on Bmon detector; Strip; Hits Count []", kuNbChanDiamond, -0.5,
773 kuNbChanDiamond - 0.5);
774 fhChanHitMapEvo = new TH2I("hChanHitMapEvo",
775 "Map of hits on Bmon detector vs time in run; "
776 "Strip; Time in run [s]; Hits Count []",
778 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
779 fvhDpbMapSpill.push_back(
780 new TH1I(Form("hDpbMapSpill%02u", uSpill),
781 Form("Map of hits on Bmon detector in current spill %02u; DPB; Hits Count []", uSpill), fuNrOfGdpbs,
782 -0.5, fuNrOfGdpbs - 0.5));
783 fvhChannelMapSpill.push_back(new TH1I(Form("hChannelMapSpill%02u", uSpill),
784 Form("Map of hits on Bmon detector in current spill %02u; Strip; "
785 "Hits Count []",
786 uSpill),
787 kuNbChanDiamond, -0.5, kuNbChanDiamond - 0.5));
788 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
789 fhHitsPerSpill = new TH1I("hHitsPerSpill", "Hit count per spill; Spill; Hits Count []", 2000, 0., 2000);
790
791 fhMsgCntEvo = new TH1I("hMsgCntEvo",
792 "Evolution of Hit & error msgs counts vs time in run; "
793 "Time in run [s]; Msgs Count []",
795 fhHitCntEvo = new TH1I("hHitCntEvo", "Evolution of Hit counts vs time in run; Time in run [s]; Hits Count []",
797 fhErrorCntEvo = new TH1I("hErrorCntEvo", "Evolution of Error counts vs time in run; Time in run [s]; Error Count []",
799 fhLostEvtCntEvo = new TH1I("hLostEvtCntEvo",
800 "Evolution of LostEvent counts vs time in run; "
801 "Time in run [s]; LostEvent Count []",
803
804 fhErrorFractEvo = new TProfile("hErrorFractEvo",
805 "Evolution of Error Fraction vs time in run; "
806 "Time in run [s]; Error Fract []",
808 fhLostEvtFractEvo = new TProfile("hLostEvtFractEvo",
809 "Evolution of LostEvent Fraction vs time in "
810 "run; Time in run [s]; LostEvent Fract []",
812
813 fhMsgCntPerMsEvo = new TH2I("hMsgCntPerMsEvo",
814 "Evolution of Hit & error msgs counts, per MS vs time in run; "
815 "Time in run [s]; Hits Count/MS []; MS",
816 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
817 fhHitCntPerMsEvo = new TH2I("hHitCntPerMsEvo",
818 "Evolution of Hit counts, per MS vs time in run; "
819 "Time in run [s]; Hits Count/MS []; MS",
820 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
821 fhErrorCntPerMsEvo = new TH2I("hErrorCntPerMsEvo",
822 "Evolution of Error counts, per MS vs time in "
823 "run; Time in run [s]; Error Count/MS []; MS",
824 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
825 fhLostEvtCntPerMsEvo = new TH2I("hLostEvtCntPerMsEvo",
826 "Evolution of LostEvent, per MS counts vs time in run; Time in "
827 "run [s]; LostEvent Count/MS []; MS",
828 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
829
830 fhErrorFractPerMsEvo = new TH2I("hErrorFractPerMsEvo",
831 "Evolution of Error Fraction, per MS vs time in run; Time in run "
832 "[s]; Error Fract/MS []; MS",
833 fuHistoryHistoSize, 0, fuHistoryHistoSize, 1000, 0, 1);
834 fhLostEvtFractPerMsEvo = new TH2I("hLostEvtFractPerMsEvo",
835 "Evolution of LostEvent Fraction, per MS vs time in run; Time in "
836 "run [s]; LostEvent Fract/MS []; MS",
837 fuHistoryHistoSize, 0, fuHistoryHistoSize, 1000, 0, 1);
838
839 fhChannelMapPulser = new TH1I("fhChannelMapPulser", "Map of pulser hits on Bmon detector; Chan; Hits Count []",
841 fhHitMapEvoPulser = new TH2I("fhHitMapEvoPulser",
842 "Map of hits on Bmon detector vs time in run; "
843 "Chan; Time in run [s]; Hits Count []",
845
847 AddHistoToVector(fhDpbMap, sFolder);
853 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
854 AddHistoToVector(fvhDpbMapSpill[uSpill], sFolder);
855 AddHistoToVector(fvhChannelMapSpill[uSpill], sFolder);
856 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
858
863
866
873
876
877 /*******************************************************************/
878 for (UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan) {
879 fvhMsgCntEvoChan[uChan] = new TH1I(Form("hMsgCntEvoChan%02u", uChan),
880 Form("Evolution of Messages counts vs time in run for channel "
881 "%02u; Time in run [s]; Messages Count []",
882 uChan),
884 fvhMsgCntPerMsEvoChan[uChan] = new TH2I(Form("hMsgCntPerMsEvoChan%02u", uChan),
885 Form("Evolution of Hit counts per MS vs time in run for channel "
886 "%02u; Time in run [s]; Hits Count/MS []; MS",
887 uChan),
888 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
889
890 fvhHitCntEvoChan[uChan] = new TH1I(Form("hHitCntEvoChan%02u", uChan),
891 Form("Evolution of Hit counts vs time in run for channel %02u; "
892 "Time in run [s]; Hits Count []",
893 uChan),
895 fvhHitCntPerMsEvoChan[uChan] = new TH2I(Form("hHitCntPerMsEvoChan%02u", uChan),
896 Form("Evolution of Hit counts per MS vs time in run for channel "
897 "%02u; Time in run [s]; Hits Count/MS []; MS",
898 uChan),
899 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
900
901 fvhErrorCntEvoChan[uChan] = new TH1I(Form("hErrorCntEvoChan%02u", uChan),
902 Form("Evolution of Error counts vs time in run for channel "
903 "%02u; Time in run [s]; Error Count []",
904 uChan),
906 fvhErrorCntPerMsEvoChan[uChan] = new TH2I(Form("hErrorCntPerMsEvoChan%02u", uChan),
907 Form("Evolution of Error counts per MS vs time in run for "
908 "channel %02u; Time in run [s]; Error Count/MS []; MS",
909 uChan),
910 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
911
912 fvhEvtLostCntEvoChan[uChan] = new TH1I(Form("hEvtLostCntEvoChan%02u", uChan),
913 Form("Evolution of LostEvent counts vs time in run for channel "
914 "%02u; Time in run [s]; LostEvent Count []",
915 uChan),
917 fvhEvtLostCntPerMsEvoChan[uChan] = new TH2I(Form("hEvtLostCntPerMsEvoChan%02u", uChan),
918 Form("Evolution of LostEvent counts per MS vs time in run for "
919 "channel %02u; Time in run [s]; LostEvent Count/MS []; MS",
920 uChan),
921 fuHistoryHistoSize, 0, fuHistoryHistoSize, iNbBinsLog, dBinsLog);
922
923 fvhErrorFractEvoChan[uChan] = new TProfile(Form("hErrorFractEvoChan%02u", uChan),
924 Form("Evolution of Error Fraction vs time in run for "
925 "channel %02u; Time in run [s]; Error Fract []",
926 uChan),
928 fvhErrorFractPerMsEvoChan[uChan] = new TH2I(Form("hErrorFractPerMsEvoChan%02u", uChan),
929 Form("Evolution of Error Fraction, per MS vs time in run for "
930 "channel %02u; Time in run [s]; Error Fract/MS []; MS",
931 uChan),
932 fuHistoryHistoSize, 0, fuHistoryHistoSize, 1000, 0, 1);
933
934 fvhEvtLostFractEvoChan[uChan] = new TProfile(Form("hEvtLostFractEvoChan%02u", uChan),
935 Form("Evolution of LostEvent Fraction vs time in run for "
936 "channel %02u; Time in run [s]; LostEvent Fract []",
937 uChan),
940 new TH2I(Form("hEvtLostFractPerMsEvoChan%02u", uChan),
941 Form("Evolution of LostEvent Fraction, per MS vs time in run for channel "
942 "%02u; Time in run [s]; LostEvent Fract/MS []; MS",
943 uChan),
944 fuHistoryHistoSize, 0, fuHistoryHistoSize, 1000, 0, 1);
945
947 AddHistoToVector(fvhMsgCntEvoChan[uChan], sFolder);
949 AddHistoToVector(fvhHitCntEvoChan[uChan], sFolder);
951 AddHistoToVector(fvhErrorCntEvoChan[uChan], sFolder);
953 AddHistoToVector(fvhEvtLostCntEvoChan[uChan], sFolder);
955 AddHistoToVector(fvhErrorFractEvoChan[uChan], sFolder);
959 } // for( UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan )
960
962 // delete dBinsLog;
963
964 /*******************************************************************/
965
967 Double_t w = 10;
968 Double_t h = 10;
969
970 /*******************************************************************/
972 fcHitMaps = new TCanvas("cHitMaps", "Hit maps", w, h);
973 fcHitMaps->Divide(2);
974
975 fcHitMaps->cd(1);
976 gPad->SetGridx();
977 gPad->SetGridy();
978 gPad->SetLogy();
979 fhChannelMap->Draw();
980
981 fcHitMaps->cd(2);
982 gPad->SetGridx();
983 gPad->SetGridy();
984 gPad->SetLogz();
985 fhHitMapEvo->Draw("colz");
986
987 AddCanvasToVector(fcHitMaps, "canvases");
988 /*******************************************************************/
989
990 /*******************************************************************/
992 fcSummary = new TCanvas("cSummary", "Hit maps, Hit rate, Error fraction", w, h);
993 fcSummary->Divide(2, 2);
994
995 fcSummary->cd(1);
996 gPad->SetGridx();
997 gPad->SetGridy();
998 gPad->SetLogy();
999 fhChannelMap->Draw();
1000
1001 fcSummary->cd(2);
1002 gPad->SetGridx();
1003 gPad->SetGridy();
1004 gPad->SetLogz();
1005 fhHitMapEvo->Draw("colz");
1006
1007 fcSummary->cd(3);
1008 gPad->SetGridx();
1009 gPad->SetGridy();
1010 gPad->SetLogy();
1011 fhHitCntEvo->Draw();
1012
1013 fcSummary->cd(4);
1014 gPad->SetGridx();
1015 gPad->SetGridy();
1016 gPad->SetLogz();
1017 fhErrorFractEvo->Draw("hist");
1018
1019 AddCanvasToVector(fcSummary, "canvases");
1020 /*******************************************************************/
1021
1022 /*******************************************************************/
1024 fcSummaryMap = new TCanvas("cSummaryMap", "Hit maps, Hit rate, Error fraction", w, h);
1025 fcSummaryMap->Divide(2, 2);
1026
1027 fcSummaryMap->cd(1);
1028 gPad->SetGridx();
1029 gPad->SetGridy();
1030 gPad->SetLogy();
1031 fhChanHitMap->Draw();
1032
1033 fcSummaryMap->cd(2);
1034 gPad->SetGridx();
1035 gPad->SetGridy();
1036 gPad->SetLogz();
1037 fhChanHitMapEvo->Draw("colz");
1038
1039 fcSummaryMap->cd(3);
1040 gPad->SetGridx();
1041 gPad->SetGridy();
1042 gPad->SetLogy();
1043 fhHitCntEvo->Draw();
1044
1045 fcSummaryMap->cd(4);
1046 gPad->SetGridx();
1047 gPad->SetGridy();
1048 gPad->SetLogz();
1049 fhErrorFractEvo->Draw("hist");
1050
1051 AddCanvasToVector(fcSummaryMap, "canvases");
1052 /*******************************************************************/
1053
1054 /*******************************************************************/
1056 fcGenCntsPerMs = new TCanvas("cGenCntsPerMs", "Messages and hit cnt per MS, Error and Evt Loss Fract. per MS ", w, h);
1057 fcGenCntsPerMs->Divide(2, 2);
1058
1059 fcGenCntsPerMs->cd(1);
1060 gPad->SetGridx();
1061 gPad->SetGridy();
1062 gPad->SetLogy();
1063 gPad->SetLogz();
1064 fhMsgCntPerMsEvo->Draw("colz");
1065
1066 fcGenCntsPerMs->cd(2);
1067 gPad->SetGridx();
1068 gPad->SetGridy();
1069 gPad->SetLogy();
1070 gPad->SetLogz();
1071 fhHitCntPerMsEvo->Draw("colz");
1072
1073 fcGenCntsPerMs->cd(3);
1074 gPad->SetGridx();
1075 gPad->SetGridy();
1076 gPad->SetLogy();
1077 gPad->SetLogz();
1078 fhErrorFractPerMsEvo->Draw("colz");
1079
1080 fcGenCntsPerMs->cd(4);
1081 gPad->SetGridx();
1082 gPad->SetGridy();
1083 gPad->SetLogy();
1084 gPad->SetLogz();
1085 fhLostEvtFractPerMsEvo->Draw("colz");
1086
1087 AddCanvasToVector(fcGenCntsPerMs, "canvases");
1088 /*******************************************************************/
1089
1090 /*******************************************************************/
1092 fcSpillCounts = new TCanvas("cSpillCounts", "Counts per spill, last 5 spills including current one", w, h);
1093 fcSpillCounts->Divide(1, kuNbSpillPlots);
1094
1095 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
1096 fcSpillCounts->cd(1 + uSpill);
1097 gPad->SetGridx();
1098 gPad->SetGridy();
1099 gPad->SetLogy();
1100 // fvhChannelMapSpill[ uSpill ]->SetStats( kTRUE );
1101 fvhChannelMapSpill[uSpill]->Draw();
1102 gPad->Update();
1103 TPaveStats* st = (TPaveStats*) fvhChannelMapSpill[uSpill]->FindObject("stats");
1104 st->SetOptStat(10);
1105 st->SetX1NDC(0.25);
1106 st->SetX2NDC(0.95);
1107 st->SetY1NDC(0.90);
1108 st->SetY2NDC(0.95);
1109 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
1110
1111 AddCanvasToVector(fcSpillCounts, "canvases");
1112 /*******************************************************************/
1113
1114 /*******************************************************************/
1116 fcSpillCountsHori = new TCanvas("cSpillCountsHori", "Counts per spill, last 5 spills including current one", w, h);
1118
1119 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
1120 fcSpillCountsHori->cd(1 + uSpill);
1121 gPad->SetGridx();
1122 gPad->SetGridy();
1123 gPad->SetLogy();
1124 fvhChannelMapSpill[uSpill]->Draw();
1125 gPad->Update();
1126 TPaveStats* st = (TPaveStats*) fvhChannelMapSpill[uSpill]->FindObject("stats");
1127 st->SetOptStat(10);
1128 st->SetX1NDC(0.25);
1129 st->SetX2NDC(0.95);
1130 st->SetY1NDC(0.90);
1131 st->SetY2NDC(0.95);
1132 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
1133
1135 /*******************************************************************/
1136
1137 /*******************************************************************/
1140 new TCanvas("cSpillDpbCountsHori", "Counts in DPB per spill, last 5 spills including current one", w, h);
1142
1143 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
1144 fcSpillDpbCountsHori->cd(1 + uSpill);
1145 gPad->SetGridx();
1146 gPad->SetGridy();
1147 gPad->SetLogy();
1148 fvhDpbMapSpill[uSpill]->Draw();
1149 gPad->Update();
1150 TPaveStats* st = (TPaveStats*) fvhDpbMapSpill[uSpill]->FindObject("stats");
1151 st->SetOptStat(110);
1152 st->SetX1NDC(0.25);
1153 st->SetX2NDC(0.95);
1154 st->SetY1NDC(0.90);
1155 st->SetY2NDC(0.95);
1156 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
1157
1159 /*******************************************************************/
1160
1161 return kTRUE;
1162}
1164{
1165 Double_t dMsgCountChan;
1166 Double_t dFractErrorsInMsChan;
1167 Double_t dFractLostEvtInMsChan;
1168 UInt_t uCountHitsInMs = 0;
1169 UInt_t uCountErrorsInMs = 0;
1170 UInt_t uCountLostEvtInMs = 0;
1171 for (UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan) {
1172 dMsgCountChan = fvuHitCntChanMs[uChan] + fvuErrorCntChanMs[uChan];
1173 dFractErrorsInMsChan = fvuErrorCntChanMs[uChan];
1174 dFractLostEvtInMsChan = fvuEvtLostCntChanMs[uChan];
1175
1176 dFractErrorsInMsChan /= dMsgCountChan;
1177 dFractLostEvtInMsChan /= dMsgCountChan;
1178
1179 fvhMsgCntEvoChan[uChan]->Fill(fdMsTime - fdStartTime, dMsgCountChan);
1180 fvhMsgCntPerMsEvoChan[uChan]->Fill(fdMsTime - fdStartTime, dMsgCountChan);
1184 fvhErrorFractPerMsEvoChan[uChan]->Fill(fdMsTime - fdStartTime, dFractErrorsInMsChan);
1185 fvhEvtLostFractPerMsEvoChan[uChan]->Fill(fdMsTime - fdStartTime, dFractLostEvtInMsChan);
1186
1187 uCountHitsInMs += fvuHitCntChanMs[uChan];
1188 uCountErrorsInMs += fvuErrorCntChanMs[uChan];
1189 uCountLostEvtInMs += fvuEvtLostCntChanMs[uChan];
1190
1191 fvuHitCntChanMs[uChan] = 0;
1192 fvuErrorCntChanMs[uChan] = 0;
1193 fvuEvtLostCntChanMs[uChan] = 0;
1194 } // for( UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan )
1195 Double_t dFractErrorsInMs = uCountErrorsInMs;
1196 Double_t dFractLostEvtInMs = uCountLostEvtInMs;
1197 dFractErrorsInMs /= (uCountHitsInMs + uCountErrorsInMs);
1198 dFractLostEvtInMs /= (uCountHitsInMs + uCountErrorsInMs);
1199
1200 fhMsgCntPerMsEvo->Fill(fdMsTime - fdStartTime, uCountHitsInMs + uCountErrorsInMs);
1201 fhHitCntPerMsEvo->Fill(fdMsTime - fdStartTime, uCountHitsInMs);
1202 fhErrorCntPerMsEvo->Fill(fdMsTime - fdStartTime, uCountErrorsInMs);
1203 fhLostEvtCntPerMsEvo->Fill(fdMsTime - fdStartTime, uCountLostEvtInMs);
1204 fhErrorFractPerMsEvo->Fill(fdMsTime - fdStartTime, dFractErrorsInMs);
1205 fhLostEvtFractPerMsEvo->Fill(fdMsTime - fdStartTime, dFractLostEvtInMs);
1206
1207 return kTRUE;
1208}
1210{
1211 for (UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan) {
1212 fvhMsgCntEvoChan[uChan]->Reset();
1213 fvhMsgCntPerMsEvoChan[uChan]->Reset();
1214
1215 fvhHitCntEvoChan[uChan]->Reset();
1216 fvhHitCntPerMsEvoChan[uChan]->Reset();
1217
1218 fvhErrorCntEvoChan[uChan]->Reset();
1219 fvhErrorCntPerMsEvoChan[uChan]->Reset();
1220
1221 fvhEvtLostCntEvoChan[uChan]->Reset();
1222 fvhEvtLostCntPerMsEvoChan[uChan]->Reset();
1223
1224 fvhErrorFractEvoChan[uChan]->Reset();
1225 fvhErrorFractPerMsEvoChan[uChan]->Reset();
1226
1227 fvhEvtLostFractEvoChan[uChan]->Reset();
1228 fvhEvtLostFractPerMsEvoChan[uChan]->Reset();
1229 } // for( UInt_t uChan = 0; uChan < kuNbChanDiamond; ++uChan )
1230
1231 fhDpbMap->Reset();
1232 fhChannelMap->Reset();
1233 fhChanHitMapEvo->Reset();
1234 fhHitMapEvo->Reset();
1235 for (UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill++) {
1236 fvhDpbMapSpill[uSpill]->Reset();
1237 fvhChannelMapSpill[uSpill]->Reset();
1238 } // for( UInt_t uSpill = 0; uSpill < kuNbSpillPlots; uSpill ++)
1239 fhHitsPerSpill->Reset();
1240
1241 fhMsgCntEvo->Reset();
1242 fhHitCntEvo->Reset();
1243 fhErrorCntEvo->Reset();
1244
1245 fhErrorFractEvo->Reset();
1246 fhLostEvtFractEvo->Reset();
1247
1248 fhMsgCntPerMsEvo->Reset();
1249 fhHitCntPerMsEvo->Reset();
1250 fhErrorCntPerMsEvo->Reset();
1251 fhLostEvtCntPerMsEvo->Reset();
1252 fhErrorFractPerMsEvo->Reset();
1253 fhLostEvtFractPerMsEvo->Reset();
1254
1255 fhChannelMapPulser->Reset();
1256 fhHitMapEvoPulser->Reset();
1257
1258 if (kTRUE == bResetTime) {
1260 fdStartTime = -1.0;
1261
1264 } // if( kTRUE == bResetTime )
1265
1266 return kTRUE;
1267}
1268// -------------------------------------------------------------------------
std::vector< double > GenerateLogBinArray(uint32_t uNbDecadesLog, uint32_t uNbStepsDecade, uint32_t uNbSubStepsInStep, uint32_t &uNbBinsLog, int32_t iStartExp, bool bAddZeroStart)
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
int Int_t
bool Bool_t
UInt_t fuNrOfChannelsPerFee
Number of channels in each GET4.
Bool_t fbSpillOn
All hits (time in bins, TOT in bins, asic, channel) in last MS, sorted with "<" operator.
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
UInt_t fuNrOfGet4PerFee
Number of FEBs per GDPB.
Bool_t ResetHistograms(Bool_t bResetTime=kTRUE)
Double_t fdStartTime
Epoch + Epoch Cycle.
UInt_t fuNrOfGet4
Number of channels in each FEE.
std::vector< gdpbv100::FullMessage > fvmHitsInMs
[DPB]
std::vector< TH2 * > fvhErrorFractPerMsEvoChan
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< ULong64_t > fvulCurrentEpochCycle
Current epoch index, per DPB.
std::vector< TProfile * > fvhEvtLostFractEvoChan
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
std::vector< TH2 * > fvhEvtLostCntPerMsEvoChan
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
CbmMcbm2018TofPar * fUnpackPar
Settings from parameter file.
std::vector< TH2 * > fvhEvtLostFractPerMsEvoChan
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
UInt_t fuMinTotPulser
Number of channels per GDPB.
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
UInt_t fuNrOfGdpbs
Readout chain dimensions and mapping.
std::vector< TProfile * > fvhErrorFractEvoChan
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< std::vector< gdpbv100::Message > > fvvmEpSupprBuffer
Buffers.
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
UInt_t fuNrOfChannelsPerGet4
Number of GET4s per FEE.
UInt_t fuHistoryHistoSize
Histograms related variables.
UInt_t fuNrOfChannelsPerGdpb
Number of GET4s per GDPB.
UInt_t fuGet4Nr
running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
std::vector< ULong64_t > fvulCurrentEpoch
Data format control: Current time references for each GDPB: merged epoch marker, epoch cycle,...
UInt_t fuNrOfGet4PerGdpb
Total number of Get4 chips in the system.
UInt_t fuGet4Id
Bin size in s for the plots with date as X axis.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
static const UInt_t kuNbSpillPlots
Channels map.
TH1 * fhDpbMap
Map from electronics channel to Diamond strip.
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< size_t > fvMsComponentsList
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Data class with information on a STS local track.
uint16_t getGdpbHitIs24b() const
uint16_t getGdpbHit32Tot() const
uint16_t getGdpbSysSubType() const
bool isStarTrigger() const
Returns true is message type is MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message)
uint16_t getGdpbGenChipId() const
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
uint16_t getGdpbSysErrData() const
@ GET4_V2X_ERR_LOST_EVT
const uint32_t kuChipIdMergedEpoch