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