20#include "FairRootManager.h"
22#include "FairRunOnline.h"
23#include "FairRuntimeDb.h"
30#include "TPaveStats.h"
48 LOG(info) <<
"Initializing mCBM Bmon 2019 monitor algo";
85 LOG(warning) <<
"Size of spill breaks beginning or end did not match: " <<
fvuSpillBreakBegTs.size() <<
" VS "
89 LOG(info) <<
"**********************************************";
90 LOG(info) <<
"TS index for beginning of spill breaks:";
92 LOG(info) << Form(
"%9llu", uBeg);
94 LOG(info) <<
"**********************************************";
95 LOG(info) <<
"TS index for ending of spill breaks:";
97 LOG(info) << Form(
"%9llu", uEnd);
99 LOG(info) <<
"**********************************************";
100 LOG(info) <<
"TS index for middle of spill breaks:";
102 LOG(info) << Form(
"%9llu", uMid);
104 LOG(info) <<
"**********************************************";
110 LOG(info) <<
"Init parameter containers for CbmMcbmSpillFindAlgo";
117 LOG(info) <<
"**********************************************";
118 LOG(info) <<
"ReInit parameter containers for CbmMcbmSpillFindAlgo";
165 LOG(info) <<
"GDPB Id of TOF " << i <<
" : " << std::hex <<
fUnpackPar->
GetGdpbId(i) << std::dec;
181 LOG(info) <<
"CbmMcbmSpillFindAlgo::AddMsComponentToList => Component " << component <<
" with detector ID 0x"
182 << std::hex << usDetectorId << std::dec <<
" added to list";
189 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
202 <<
" Overlap MS, for a core duration of " <<
fdTsCoreSizeInNs <<
" ns and a full duration of "
208 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
241 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
243 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
245 uint32_t uSize = msDescriptor.size;
249 <<
" has size: " << uSize;
259 LOG(info) <<
"---------------------------------------------------------------";
260 LOG(info) <<
"Component " << uMsCompIdx <<
" TS Idx " <<
fulCurrentTsIdx;
261 LOG(info) <<
"hi hv eqid flag si sv idx/start crc size offset";
262 LOG(info) << Form(
"%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx",
263 static_cast<unsigned int>(msDescriptor.hdr_id),
static_cast<unsigned int>(msDescriptor.hdr_ver),
264 msDescriptor.eq_id, msDescriptor.flags,
static_cast<unsigned int>(msDescriptor.sys_id),
265 static_cast<unsigned int>(msDescriptor.sys_ver),
static_cast<unsigned long>(msDescriptor.idx),
266 msDescriptor.crc, msDescriptor.size,
static_cast<unsigned long>(msDescriptor.offset));
275 LOG(info) <<
"---------------------------------------------------------------";
286 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex <<
fuCurrDpbId << std::dec
287 <<
" in timeslice " <<
fulCurrentTsIdx <<
" in microslice " << uMsIdx <<
" component " << uMsCompIdx
289 <<
"If valid this index has to be added in the TOF "
290 "parameter file in the DbpIdArray field";
346 LOG(error) <<
"The input microslice buffer does NOT "
347 <<
"contain only complete nDPB messages!";
353 Int_t messageType = -111;
354 ULong64_t ulNbHitsTs = 0;
355 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
356 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
358 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
361 if (0 == uIdx) {
continue; }
374 <<
" set in parameters.";
376 switch (messageType) {
379 LOG(error) <<
"This event builder does not support 24b hit message!!!.";
412 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
413 <<
" not included in Get4 unpacker.";
426 std::string sFolder =
"SpillFinder";
428 LOG(info) <<
"create Histos for Bmon monitoring ";
431 uint32_t iNbBinsLog = 0;
440 fhHitsPerSpill =
new TH1I(
"hHitsPerSpill",
"Hit count per spill; Spill; Hits Count []", 2000, 0., 2000);
441 fhSpillBreakDuration =
new TH1I(
"hSpillBreakDuration",
"Spill break duration; Spill; Duration [TS]", 2000, 0., 2000);
442 fhSpillDuration =
new TH1I(
"hSpillDuration",
"Spill duration; Spill; Duration [TS]", 2000, 0., 2000);
463 fcHitMaps = new TCanvas("cHitMaps", "Hit maps", w, h);
464 fcHitMaps->Divide(2);
470 fhChannelMap->Draw();
476 fhHitMapEvo->Draw("colz");
478 AddCanvasToVector(fcHitMaps, "canvases");
495 if (kTRUE == bResetTime) {
Int_t GetNrOfGdpbs()
FIXME: replace with method returning the correspondign constants! see Star2019 parameter.
Int_t GetNrOfGet4PerFee()
Int_t GetNrOfFeesPerGdpb()
Int_t GetNrOfChannelsPerGet4()
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