19#include "FairRootManager.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
28#include "TPaveStats.h"
45 LOG(info) <<
"Initializing mCBM Bmon 2019 monitor algo";
82 LOG(warning) <<
"Size of spill breaks beginning or end did not match: " <<
fvuSpillBreakBegTs.size() <<
" VS "
86 LOG(info) <<
"**********************************************";
87 LOG(info) <<
"TS index for beginning of spill breaks:";
89 LOG(info) << Form(
"%9llu", uBeg);
91 LOG(info) <<
"**********************************************";
92 LOG(info) <<
"TS index for ending of spill breaks:";
94 LOG(info) << Form(
"%9llu", uEnd);
96 LOG(info) <<
"**********************************************";
97 LOG(info) <<
"TS index for middle of spill breaks:";
99 LOG(info) << Form(
"%9llu", uMid);
101 LOG(info) <<
"**********************************************";
107 LOG(info) <<
"Init parameter containers for CbmMcbmSpillFindAlgo";
114 LOG(info) <<
"**********************************************";
115 LOG(info) <<
"ReInit parameter containers for CbmMcbmSpillFindAlgo";
162 LOG(info) <<
"GDPB Id of TOF " << i <<
" : " << std::hex <<
fUnpackPar->GetGdpbId(i) << std::dec;
178 LOG(info) <<
"CbmMcbmSpillFindAlgo::AddMsComponentToList => Component " << component <<
" with detector ID 0x"
179 << std::hex << usDetectorId << std::dec <<
" added to list";
186 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
199 <<
" Overlap MS, for a core duration of " <<
fdTsCoreSizeInNs <<
" ns and a full duration of "
205 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
238 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
240 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
242 uint32_t uSize = msDescriptor.size;
246 <<
" has size: " << uSize;
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));
272 LOG(info) <<
"---------------------------------------------------------------";
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
286 <<
"If valid this index has to be added in the TOF "
287 "parameter file in the DbpIdArray field";
343 LOG(error) <<
"The input microslice buffer does NOT "
344 <<
"contain only complete nDPB messages!";
350 Int_t messageType = -111;
351 ULong64_t ulNbHitsTs = 0;
352 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
353 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
355 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
358 if (0 == uIdx) {
continue; }
371 <<
" set in parameters.";
373 switch (messageType) {
376 LOG(error) <<
"This event builder does not support 24b hit message!!!.";
409 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
410 <<
" not included in Get4 unpacker.";
423 std::string sFolder =
"SpillFinder";
425 LOG(info) <<
"create Histos for Bmon monitoring ";
428 uint32_t iNbBinsLog = 0;
437 fhHitsPerSpill =
new TH1I(
"hHitsPerSpill",
"Hit count per spill; Spill; Hits Count []", 2000, 0., 2000);
438 fhSpillBreakDuration =
new TH1I(
"hSpillBreakDuration",
"Spill break duration; Spill; Duration [TS]", 2000, 0., 2000);
439 fhSpillDuration =
new TH1I(
"hSpillDuration",
"Spill duration; Spill; Duration [TS]", 2000, 0., 2000);
460 fcHitMaps = new TCanvas("cHitMaps", "Hit maps", w, h);
461 fcHitMaps->Divide(2);
467 fhChannelMap->Draw();
473 fhHitMapEvo->Draw("colz");
475 AddCanvasToVector(fcHitMaps, "canvases");
492 if (kTRUE == bResetTime) {
UInt_t fuCurrentEquipmentId
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
TH1 * fhHitsEvo
Histograms.
ULong64_t fulCurrentTsIdx
First TS index, forward point set ~30 years...
Double_t fdSpillCheckInterval
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)
UInt_t fuNrOfGdpbs
Readout chain dimensions and mapping.
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
Bool_t ProcessTs(const fles::Timeslice &ts)
UInt_t fuCountsLastInterval
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
UInt_t fuNrOfChannelsPerGdpb
Number of GET4s per GDPB.
Double_t fdLastSecondTime
UInt_t fuOffSpillCountLimit
UInt_t fuNrOfGet4
Number of channels in each FEE.
Double_t fdStartTimeSpill
UInt_t fuMinTotPulser
Number of channels per GDPB.
Bool_t CreateHistograms()
Bool_t ReInitContainers()
UInt_t fuNrOfGet4PerGdpb
Total number of Get4 chips in the system.
Bool_t fbMonitorMode
Control flags.
TH1 * fhSpillBreakDuration
UInt_t fuGet4Nr
running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
std::vector< ULong64_t > fvuSpillBreakMidTs
UInt_t fuNrOfGet4PerFee
Number of FEBs per GDPB.
Bool_t ResetHistograms(Bool_t bResetTime=kTRUE)
Bool_t fbSpillOn
Time of run Start from UNIX system, used as reference for long evolution plots against reception time...
CbmMcbm2018TofPar * fUnpackPar
Settings from parameter file.
UInt_t fuNrOfChannelsPerGet4
Number of GET4s per FEE.
UInt_t fuHistoryHistoSize
Histograms related variables.
std::vector< ULong64_t > fvuSpillBreakBegTs
std::vector< ULong64_t > fvuSpillBreakEndTs
Double_t fdStartTime
running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message
static const UInt_t kuBytesPerMessage
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
ULong64_t fulCurrentMsIdx
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
UInt_t fuNrOfChannelsPerFee
Number of channels in each GET4.
Double_t fdTsCoreSizeInNs
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< size_t > fvMsComponentsList
Double_t fdTsFullSizeInNs
uint16_t getGdpbHitIs24b() const
uint16_t getGdpbHit32Tot() 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.
const uint32_t kuChipIdMergedEpoch