CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorStsPulser.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmCosy2018MonitorPulser -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#include "CbmCosy2018MonitorPulser.h"
13
14// Data
15
16// CbmRoot
17#include "CbmCern2017UnpackParHodo.h"
18#include "CbmHistManager.h"
19
20// FairRoot
21#include "FairRootManager.h"
22#include "FairRun.h"
23#include "FairRunOnline.h"
24#include "FairRuntimeDb.h"
25#include <Logger.h>
26
27// Root
28#include "TClonesArray.h"
29#include "THttpServer.h"
30#include "TMath.h"
31#include "TROOT.h"
32#include "TRandom.h"
33#include "TString.h"
34#include "TStyle.h"
35
36// C++11
37
38// C/C++
39#include <cstdint>
40#include <iomanip>
41#include <iostream>
42
45
47 : CbmTSUnpack()
48 , fuOverlapMsNb(0)
49 , fUnpackParHodo(NULL)
50 , fuNrOfDpbs(0)
53 , fuNbStsXyters(0)
56 , fsHistoFileFullname("data/SetupHistos.root")
57 , fbPrintMessages(kFALSE)
58 , fPrintMessCtrl(stsxyter::MessagePrintMask::msg_print_Human)
61 , fmMsgCounter()
63 , fuCurrDpbId(0)
64 , fuCurrDpbIdx(0)
72 , fvdMsTime()
76 ,
77 // fvmChanHitsInTs(),
78 fdStartTime(-1.0)
79 , fdStartTimeMsSz(-1.0)
80 , ftStartTimeUnix(std::chrono::steady_clock::now())
81 , fvmHitsInTs()
84 , fbLongHistoEnable(kFALSE)
88 , fdCoincCenter(0.0)
89 , fdCoincBorder(50.0)
92 , fHM(new CbmHistManager())
93 , fhPulserMessType(NULL)
111 , fcMsSizeAll(NULL)
112 , fdStartTs(0.0)
121{
122}
123
125
127{
128 LOG(info) << "Initializing flib StsXyter unpacker for STS";
129
130 FairRootManager* ioman = FairRootManager::Instance();
131 if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; }
132
133 return kTRUE;
134}
135
137{
138 LOG(info) << "Setting parameter containers for " << GetName();
140 (CbmCern2017UnpackParHodo*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmCern2017UnpackParHodo"));
141}
142
143
145{
146 LOG(info) << "Init parameter containers for " << GetName();
147
148 Bool_t bReInit = ReInitContainers();
150
151 return bReInit;
152}
153
155{
156 LOG(info) << "ReInit parameter containers for " << GetName();
157
158 fuNrOfDpbs = fUnpackParHodo->GetNrOfDpbs();
159 fuNbElinksPerDpb = fUnpackParHodo->GetNbElinksPerDpb();
160 fuNbStsXyters = fUnpackParHodo->GetNbStsXyters();
161 fuNbChanPerAsic = fUnpackParHodo->GetNbChanPerAsic();
162
163
164 LOG(info) << "Nr. of STS DPBs: " << fuNrOfDpbs;
165
166 fDpbIdIndexMap.clear();
168 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
169 fDpbIdIndexMap[fUnpackParHodo->GetDpbId(uDpb)] = uDpb;
170 LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = " << std::setw(4) << std::hex
171 << fUnpackParHodo->GetDpbId(uDpb) << std::dec << " => " << fDpbIdIndexMap[fUnpackParHodo->GetDpbId(uDpb)];
172
173 fvuElinkToAsic[uDpb].resize(fuNbElinksPerDpb);
174 for (UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink)
175 fvuElinkToAsic[uDpb][uElink] = fUnpackParHodo->GetElinkToAsicIdx(uDpb * fuNbElinksPerDpb + uElink);
176 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
177
178 LOG(info) << "Nr. eLinks per DPB: " << fuNbElinksPerDpb;
179 LOG(info) << "Nr. of StsXyter ASICs: " << fuNbStsXyters;
180 LOG(info) << "Nb. channels per ASIC: " << fuNbChanPerAsic;
181
182 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
183 LOG(info) << "ASIC ID for eLinks in DPB #" << std::setw(2) << uDpb << ": ";
184
185 std::stringstream ss;
186 for (UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink) {
187 if (0 == uElink % 10) ss << "\n------> ";
188
189 ss << std::setw(5) << fvuElinkToAsic[uDpb][uElink] << " ";
190 } // for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
191 LOG(info) << ss.str();
192 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
193
194 // Internal status initialization
198 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
199 fvulCurrentTsMsb[uDpb] = 0;
200 fvuCurrentTsMsbCycle[uDpb] = 0;
201 /*
202 fvuElinkLastTsHit[uDpb].resize( fuNbElinksPerDpb );
203 for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
204 {
205 fvuElinkLastTsHit[uDpb][uElink] = 0;
206 } // for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
207*/
208 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
209
222 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
223 fvulChanLastHitTime[uXyterIdx].resize(fuNbChanPerAsic);
224 fvdChanLastHitTime[uXyterIdx].resize(fuNbChanPerAsic);
225 fvuChanNbHitsInMs[uXyterIdx].resize(fuNbChanPerAsic);
226 fvdChanLastHitTimeInMs[uXyterIdx].resize(fuNbChanPerAsic);
227 fvusChanLastHitAdcInMs[uXyterIdx].resize(fuNbChanPerAsic);
228 fvmAsicHitsInTs[uXyterIdx].clear();
229 fhPulserTimeDiffPerAsicPair[uXyterIdx].clear();
230 fhPulserTimeDiffEvoPerAsicPair[uXyterIdx].clear();
231 fhPulserTsLsbMatchPerAsicPair[uXyterIdx].clear();
232 fhPulserTsMsbMatchPerAsicPair[uXyterIdx].clear();
233 for (UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan) {
234 fvulChanLastHitTime[uXyterIdx][uChan] = 0;
235 fvdChanLastHitTime[uXyterIdx][uChan] = -1.0;
236
237 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
238 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
239 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
240 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
241 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
242 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
243 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
244 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
245 } // for( UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan )
246 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
247 LOG(info) << "CbmCosy2018MonitorPulser::ReInitContainers => Changed "
248 "fvuChanNbHitsInMs size "
249 << fvuChanNbHitsInMs.size() << " VS " << fuNbStsXyters;
250 LOG(info) << "CbmCosy2018MonitorPulser::ReInitContainers => Changed "
251 "fvuChanNbHitsInMs size "
252 << fvuChanNbHitsInMs[0].size() << " VS " << fuNbChanPerAsic;
253 LOG(info) << "CbmCosy2018MonitorPulser::ReInitContainers => Changed "
254 "fvuChanNbHitsInMs size "
255 << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
256
257 return kTRUE;
258}
259
260void CbmCosy2018MonitorPulser::SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
261{
262 fdCoincCenter = dCenterPos;
263 fdCoincBorder = dBorderVal;
264 fdCoincMin = dCenterPos - dBorderVal;
265 fdCoincMax = dCenterPos + dBorderVal;
266}
267
269{
270 TString sHistName {""};
271 TString title {""};
272
273 sHistName = "hPulserMessageType";
274 title = "Nb of message for each type; Type";
275 fhPulserMessType = new TH1I(sHistName, title, 5, 0., 5.);
276 fhPulserMessType->GetXaxis()->SetBinLabel(1, "Dummy");
277 fhPulserMessType->GetXaxis()->SetBinLabel(2, "Hit");
278 fhPulserMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
279 fhPulserMessType->GetXaxis()->SetBinLabel(4, "Epoch");
280 fhPulserMessType->GetXaxis()->SetBinLabel(5, "Empty");
281 /* *** Missing int + MessType OP!!!! ****
282 fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
283 fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
284 fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
285 fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
286 fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
287*/
288
289 sHistName = "hPulserSysMessType";
290 title = "Nb of system message for each type; System Type";
291 fhPulserSysMessType = new TH1I(sHistName, title, 17, 0., 17.);
292 /*
293 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
294 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
295 hSysMessType->GetXaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
296*/
297
298 sHistName = "hPulserMessageTypePerDpb";
299 title = "Nb of message of each type for each DPB; DPB; Type";
300 fhPulserMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 5, 0., 5.);
301 fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
302 fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
303 fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
304 fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
305 fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Empty");
306 /* *** Missing int + MessType OP!!!! ****
307 fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
308 fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
309 fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
310 fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
311 fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
312*/
313
314 sHistName = "hPulserSysMessTypePerDpb";
315 title = "Nb of system message of each type for each DPB; DPB; System Type";
316 fhPulserSysMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 17, 0., 17.);
317 /*
318 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
319 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
320 hSysMessType->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
321*/
322
323 sHistName = "hPulserMessageTypePerElink";
324 title = "Nb of message of each type for each eLink; eLink; Type";
326 new TH2I(sHistName, title, fuNrOfDpbs * fuNbElinksPerDpb, 0, fuNrOfDpbs * fuNbElinksPerDpb, 5, 0., 5.);
327 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
328 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
329 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
330 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(4, "ReadDataAck");
331 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(5, "Ack");
332 /* *** Missing int + MessType OP!!!! ****
333 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
334 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
335 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
336 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
337 fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
338*/
339
340 sHistName = "hPulserSysMessTypePerElink";
341 title = "Nb of system message of each type for each eLink; eLink; System Type";
343 new TH2I(sHistName, title, fuNrOfDpbs * fuNbElinksPerDpb, 0, fuNrOfDpbs * fuNbElinksPerDpb, 17, 0., 17.);
344 /*
345 fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
346 fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
347 fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
348*/
349
350 // Number of rate bins =
351 // 9 for the sub-unit decade
352 // + 9 for each unit of each decade * 10 for the subdecade range
353 // + 1 for the closing bin top edge
354 const Int_t iNbDecadesRate = 9;
355 const Int_t iNbStepsDecade = 9;
356 const Int_t iNbSubStepsInStep = 10;
357 const Int_t iNbBinsRate = iNbStepsDecade + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate + 1;
358 Double_t dBinsRate[iNbBinsRate];
359 // First fill sub-unit decade
360 for (Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU++)
361 dBinsRate[iSubU] = 0.1 * (1 + iSubU);
362 std::cout << std::endl;
363 // Then fill the main decades
364 Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
365 for (Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade++) {
366 Double_t dBase = std::pow(10, iDecade);
367 Int_t iDecadeIdx = iNbStepsDecade + iDecade * iNbStepsDecade * iNbSubStepsInStep;
368 for (Int_t iStep = 0; iStep < iNbStepsDecade; iStep++) {
369 Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
370 for (Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++) {
371 dBinsRate[iStepIdx + iSubStep] = dBase * (1 + iStep) + dBase * dSubstepSize * iSubStep;
372 } // for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
373 } // for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
374 } // for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
375 dBinsRate[iNbBinsRate - 1] = std::pow(10, iNbDecadesRate);
376
379 fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec;
380
381 UInt_t uNbBinEvo = (32768 + 1) * 2;
382 Double_t dMaxEdgeEvo = stsxyter::kdClockCycleNs * static_cast<Double_t>(uNbBinEvo) / 2.0;
383 Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
384
385 UInt_t uNbBinDt = static_cast<UInt_t>((fdCoincMax - fdCoincMin) / stsxyter::kdClockCycleNs);
386
387 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
388 // Channel counts
389 sHistName = Form("hPulserChanCntRaw_%03u", uXyterIdx);
390 title = Form("Hits Count per channel, StsXyter #%03u; Channel; Hits []", uXyterIdx);
391 fhPulserChanCntRaw.push_back(new TH1I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
392
393 sHistName = Form("hPulserChanCntRawGood_%03u", uXyterIdx);
394 title = Form("Hits Count per channel in good MS, StsXyter #%03u; Channel; Hits []", uXyterIdx);
395 fhPulserChanCntRawGood.push_back(new TH1I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
396
397 // Raw Adc Distribution
398 sHistName = Form("hPulserChanAdcRaw_%03u", uXyterIdx);
399 title = Form("Raw Adc distribution per channel, StsXyter #%03u; Channel "
400 "[]; Adc []; Hits []",
401 uXyterIdx);
402 fhPulserChanAdcRaw.push_back(new TH2I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5,
404
405 // Raw Adc Distribution profile
406 sHistName = Form("hPulserChanAdcRawProfc_%03u", uXyterIdx);
407 title = Form("Raw Adc prodile per channel, StsXyter #%03u; Channel []; Adc []", uXyterIdx);
408 fhPulserChanAdcRawProf.push_back(new TProfile(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
409
410 // Raw Ts Distribution
411 sHistName = Form("hPulserChanRawTs_%03u", uXyterIdx);
412 title = Form("Raw Timestamp distribution per channel, StsXyter #%03u; "
413 "Channel []; Ts []; Hits []",
414 uXyterIdx);
415 fhPulserChanRawTs.push_back(new TH2I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5,
417
418 // Missed event flag
419 sHistName = Form("hPulserChanMissEvt_%03u", uXyterIdx);
420 title = Form("Missed Event flags per channel, StsXyter #%03u; Channel []; "
421 "Miss Evt []; Hits []",
422 uXyterIdx);
423 fhPulserChanMissEvt.push_back(
424 new TH2I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5, 2, -0.5, 1.5));
425
426 // Missed event flag counts evolution
427
428 sHistName = Form("hPulserChanMissEvtEvo_%03u", uXyterIdx);
429 title = Form("Missed Evt flags per second & channel in StsXyter #%03u; "
430 "Time [s]; Channel []; Missed Evt flags []",
431 uXyterIdx);
432 fhPulserChanMissEvtEvo.push_back(
433 new TH2I(sHistName, title, 1800, 0, 1800, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
434
435 // Missed event flag counts evo per StsXyter
436
437 sHistName = Form("hPulserFebMissEvtEvo%03u", uXyterIdx);
438 title = Form("Missed Evt flags per second in StsXyter #%03u; Time [s]; "
439 "Missed Evt flags []",
440 uXyterIdx);
441 fhPulserFebMissEvtEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
442
443 // Hit rates evo per channel
444 sHistName = Form("hPulserChanRateEvo_%03u", uXyterIdx);
445 title = Form("Hits per second & channel in StsXyter #%03u; Time [s]; "
446 "Channel []; Hits []",
447 uXyterIdx);
448 fhPulserChanHitRateEvo.push_back(
449 new TH2I(sHistName, title, 1800, 0, 1800, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
450
451 // Hit rates evo per StsXyter
452 sHistName = Form("hPulserFebRateEvo_%03u", uXyterIdx);
453 title = Form("Hits per second in StsXyter #%03u; Time [s]; Hits []", uXyterIdx);
454 fhPulserFebRateEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
455
456 // Hit rates evo per channel, 1 minute bins, 24h
457 sHistName = Form("hPulserChanRateEvoLong_%03u", uXyterIdx);
458 title = Form("Hits per second & channel in StsXyter #%03u; Time [min]; "
459 "Channel []; Hits []",
460 uXyterIdx);
461 fhPulserChanHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
462 fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
463
464 // Hit rates evo per StsXyter, 1 minute bins, 24h
465 sHistName = Form("hPulserFebRateEvoLong_%03u", uXyterIdx);
466 title = Form("Hits per second in StsXyter #%03u; Time [min]; Hits []", uXyterIdx);
467 fhPulserFebRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
468
470 sHistName = Form("fhPulserTimeDiffPerAsic_%03u", uXyterIdx);
471 title = Form("Time diff for pulser hits between ASIC %03u and other ASICs; "
472 "tn - t%03u [ns]; ASIC n; Counts",
473 uXyterIdx, uXyterIdx);
474 fhPulserTimeDiffPerAsic.push_back(
475 new TH2I(sHistName, title, uNbBinEvo, dMinEdgeEvo, dMaxEdgeEvo, fuNbStsXyters, -0.5, fuNbStsXyters - 0.5));
476
477 for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
478 if (uXyterIdxB == uXyterIdx) {
479 sHistName = Form("fhPulserTimeDiffSameAsic_%03u", uXyterIdx);
480 title = Form("Time diff for consecutive hits in ASIC %03u; tn - t [ns]; Counts", uXyterIdx);
481 } // if( uXyterIdxB == uXyterIdx )
482 else {
483 sHistName = Form("fhPulserTimeDiffPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
484 title = Form("Time diff for pulser hits in ASIC %03u and %03u; tn - t "
485 "[ns]; Counts",
486 uXyterIdx, uXyterIdxB);
487 } // else of if( uXyterIdxB == uXyterIdx )
488 fhPulserTimeDiffPerAsicPair[uXyterIdx].push_back(new TH1I(sHistName, title, uNbBinEvo, dMinEdgeEvo, dMaxEdgeEvo));
489
490 if (uXyterIdxB == uXyterIdx) {
491 sHistName = Form("fhPulserTimeDiffEvoSameAsic_%03u", uXyterIdx);
492 title = Form("Time diff for consecutive hits in ASIC %03u; Time in run "
493 "[s]; tn - t [ns]; Counts",
494 uXyterIdx);
495 } // if( uXyterIdxB == uXyterIdx )
496 else {
497 sHistName = Form("fhPulserTimeDiffEvoPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
498 title = Form("Time diff for pulser hits in ASIC %03u and %03u; Time in "
499 "run [s]; tn - t [ns]; Counts",
500 uXyterIdx, uXyterIdxB);
501 } // else of if( uXyterIdxB == uXyterIdx )
502 fhPulserTimeDiffEvoPerAsicPair[uXyterIdx].push_back(new TH2I(
503 sHistName, title, 3600, 0, 18000, 200, -100 * stsxyter::kdClockCycleNs, 100 * stsxyter::kdClockCycleNs));
504
505 sHistName = Form("fhPulserTsLsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
506 title = Form("TS LSB for pulser hits in ASIC %03u and %03u; TS LSB %03u "
507 "[bin]; TS LSB %03u [bin]",
508 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
509 fhPulserTsLsbMatchPerAsicPair[uXyterIdx].push_back(
510 new TH2I(sHistName, title, 256, -0.5, 255.5, 256, -0.5, 255.5));
511
512 sHistName = Form("fhPulserTsMsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
513 title = Form("TS MSB for pulser hits in ASIC %03u and %03u; TS MSB %03u "
514 "[bin]; TS MSB %03u [bin]",
515 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
516 fhPulserTsMsbMatchPerAsicPair[uXyterIdx].push_back(new TH2I(sHistName, title, 64, -0.5, 63.5, 64, -0.5, 63.5));
517 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
518
519 sHistName = Form("fhPulserIntervalAsic_%03u", uXyterIdx);
520 title = Form("Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
521 fhPulserIntervalAsic.push_back(new TH1I(sHistName, title, 200, 0, 200 * stsxyter::kdClockCycleNs));
522
523 sHistName = Form("fhPulserIntervalLongAsic_%03u", uXyterIdx);
524 title = Form("Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
525 fhPulserIntervalLongAsic.push_back(new TH1I(sHistName, title, 1e5, 0, 1e6 * stsxyter::kdClockCycleNs));
526
528 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
529
530
532
533 /*
534 // Distribution of the TS_MSB per StsXyter
535 sHistName = "hPulserFebTsMsb";
536 title = "Raw Timestamp Msb distribution per StsXyter; Ts MSB []; StsXyter []; Hits []";
537 fhPulserFebTsMsb = new TH2I( sHistName, title, stsxyter::kuTsMsbNbTsBins, -0.5, stsxyter::kuTsMsbNbTsBins - 0.5,
538 fuNbStsXyters, -0.5, fuNbStsXyters - 0.5 );
539 if( server ) server->Register("/StsRaw", fhPulserFebTsMsb );
540*/
541 // Miscroslice properties histos
542 for (Int_t component = 0; component < kiMaxNbFlibLinks; component++) {
543 fhMsSz[component] = NULL;
544 fhMsSzTime[component] = NULL;
545 } // for( Int_t component = 0; component < kiMaxNbFlibLinks; component ++ )
546
547 // Online histo browser commands
548 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
549 if (server) {
550 server->Register("/StsRaw", fhPulserMessType);
551 server->Register("/StsRaw", fhPulserSysMessType);
552 server->Register("/StsRaw", fhPulserMessTypePerDpb);
553 server->Register("/StsRaw", fhPulserSysMessTypePerDpb);
554 server->Register("/StsRaw", fhPulserMessTypePerElink);
555 server->Register("/StsRaw", fhPulserSysMessTypePerElink);
556 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
557 server->Register("/StsRaw", fhPulserChanCntRaw[uXyterIdx]);
558 server->Register("/StsRaw", fhPulserChanCntRawGood[uXyterIdx]);
559 server->Register("/StsRaw", fhPulserChanAdcRaw[uXyterIdx]);
560 server->Register("/StsRaw", fhPulserChanAdcRawProf[uXyterIdx]);
561 server->Register("/StsRaw", fhPulserChanRawTs[uXyterIdx]);
562 server->Register("/StsRaw", fhPulserChanMissEvt[uXyterIdx]);
563 server->Register("/StsRaw", fhPulserChanMissEvtEvo[uXyterIdx]);
564 server->Register("/StsRaw", fhPulserFebMissEvtEvo[uXyterIdx]);
565 server->Register("/StsRaw", fhPulserChanHitRateEvo[uXyterIdx]);
566 server->Register("/StsRaw", fhPulserFebRateEvo[uXyterIdx]);
567 server->Register("/StsRaw", fhPulserChanHitRateEvoLong[uXyterIdx]);
568 server->Register("/StsRaw", fhPulserFebRateEvoLong[uXyterIdx]);
569
570 server->Register("/DtAsic", fhPulserTimeDiffPerAsic[uXyterIdx]);
571 for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
572 if (uXyterIdxB == uXyterIdx) {
573 server->Register("/DtChan", fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]);
574 server->Register("/DtChan", fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]);
575 } // if( uXyterIdxB == uXyterIdx )
576 else {
577 server->Register("/DtAsicPair", fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]);
578 server->Register("/DtAsicPair", fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]);
579 } // else of if( uXyterIdxB == uXyterIdx )
580 server->Register("/TsMatch", fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]);
581 server->Register("/TsMatch", fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]);
582 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
583 server->Register("/DtPulses", fhPulserIntervalAsic[uXyterIdx]);
584 server->Register("/DtPulses", fhPulserIntervalLongAsic[uXyterIdx]);
585
586 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
587
588 server->RegisterCommand("/Reset_All_Pulser", "bCosy2018ResetPulser=kTRUE");
589 server->RegisterCommand("/Write_All_Pulser", "bCosy2018WritePulser=kTRUE");
590
591 server->Restrict("/Reset_All_Pulser", "allow=admin");
592 server->Restrict("/Write_All_Pulser", "allow=admin");
593 } // if( server )
594
596 Double_t w = 10;
597 Double_t h = 10;
598
599 // Summary per StsXyter
600 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
601 TCanvas* cStsSumm =
602 new TCanvas(Form("cStsSum_%03u", uXyterIdx), Form("Summary plots for StsXyter %03u", uXyterIdx), w, h);
603 cStsSumm->Divide(2, 2);
604
605 cStsSumm->cd(1);
606 gPad->SetLogy();
607 fhPulserChanCntRaw[uXyterIdx]->Draw();
608
609 cStsSumm->cd(2);
610 gPad->SetLogz();
611 fhPulserChanAdcRaw[uXyterIdx]->Draw("colz");
612
613 cStsSumm->cd(3);
614 gPad->SetLogz();
615 fhPulserChanHitRateEvo[uXyterIdx]->Draw("colz");
616
617 cStsSumm->cd(4);
618 // gPad->SetLogy();
619 fhPulserChanAdcRawProf[uXyterIdx]->Draw();
620 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
621
622 //====================================================================//
623
624 //====================================================================//
625 TCanvas* cDtPerAsic = new TCanvas("cDtPerAsic", "Time Differences per ASIC", w, h);
626 cDtPerAsic->Divide(fuNbStsXyters / 2 + fuNbStsXyters % 2, 2);
627
628 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
629 cDtPerAsic->cd(1 + uXyterIdx);
630 gPad->SetGridx();
631 gPad->SetGridy();
632 gPad->SetLogz();
633 fhPulserTimeDiffPerAsic[uXyterIdx]->Draw(" colz");
634 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
635 //====================================================================//
636
637 //====================================================================//
638 TCanvas* cDtInAsic = new TCanvas("cDtInAsic", "Time Differences in ASIC", w, h);
639 cDtInAsic->Divide(fuNbStsXyters / 2 + fuNbStsXyters % 2, 2);
640
641 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
642 cDtInAsic->cd(1 + uXyterIdx);
643 gPad->SetGridx();
644 gPad->SetLogy();
645 fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdx]->Draw("hist");
646 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
647 //====================================================================//
648
649 //====================================================================//
650 TCanvas* cDtAsicPairs = new TCanvas("cDtAsicPairs", "Time Differences in ASIC", w, h);
651 // cDtAsicPairs->Divide( fuNbStsXyters / 3, 3 );
652 cDtAsicPairs->Divide(3);
653
654 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
655 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
656 cDtAsicPairs->cd(uXyterIdx + uXyterIdxB);
657 gPad->SetGridx();
658 gPad->SetLogy();
659 fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("hist");
660 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
661 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
662 //====================================================================//
663
664 //====================================================================//
665 TCanvas* cTsLsbAsicPairs = new TCanvas("cTsLsbAsicPairs", "Time Differences in ASIC", w, h);
666 // cDtAsicPairs->Divide( fuNbStsXyters / 3, 3 );
667 cTsLsbAsicPairs->Divide(3);
668
669 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
670 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
671 cTsLsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
672 gPad->SetGridx();
673 gPad->SetGridy();
674 gPad->SetLogz();
675 fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("colz");
676 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
677 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
678 //====================================================================//
679
680 //====================================================================//
681 TCanvas* cTsMsbAsicPairs = new TCanvas("cTsMsbAsicPairs", "Time Differences in ASIC", w, h);
682 // cDtAsicPairs->Divide( fuNbStsXyters / 3, 3 );
683 cTsMsbAsicPairs->Divide(3);
684
685 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
686 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
687 cTsMsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
688 gPad->SetGridx();
689 gPad->SetGridy();
690 gPad->SetLogz();
691 fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("colz");
692 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
693 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
694 //====================================================================//
695
696 //====================================================================//
698 // Try to recover canvas in case it was created already by another monitor
699 // If not existing, create it
700 fcMsSizeAll = dynamic_cast<TCanvas*>(gROOT->FindObject("cMsSizeAll"));
701 if (NULL == fcMsSizeAll) {
702 fcMsSizeAll = new TCanvas("cMsSizeAll", "Evolution of MS size in last 300 s", w, h);
703 fcMsSizeAll->Divide(4, 4);
704 LOG(info) << "Created MS size canvas in STS monitor";
705 } // if( NULL == fcMsSizeAll )
706 else
707 LOG(info) << "Recovered MS size canvas in STS monitor";
708 //====================================================================//
709
710 /*****************************/
711}
712
713Bool_t CbmCosy2018MonitorPulser::DoUnpack(const fles::Timeslice& ts, size_t component)
714{
715 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
716
719 bCosy2018ResetPulser = kFALSE;
720 } // if( bCosy2018ResetPulser )
723 bCosy2018WritePulser = kFALSE;
724 } // if( bCosy2018WritePulser )
725
726 LOG(debug) << "Timeslice contains " << ts.num_microslices(component) << "microslices.";
727
728 if (component < kiMaxNbFlibLinks)
729 if (NULL == fhMsSz[component]) {
730 TString sMsSzName = Form("MsSz_link_%02lu", component);
731 TString sMsSzTitle = Form("Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
732 fhMsSz[component] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
733 fHM->Add(sMsSzName.Data(), fhMsSz[component]);
734 if (server) server->Register("/FlibRaw", fhMsSz[component]);
735 sMsSzName = Form("MsSzTime_link_%02lu", component);
736 sMsSzTitle = Form("Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
737 fhMsSzTime[component] = new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
738 fHM->Add(sMsSzName.Data(), fhMsSzTime[component]);
739 if (server) server->Register("/FlibRaw", fhMsSzTime[component]);
740 if (NULL != fcMsSizeAll) {
741 fcMsSizeAll->cd(1 + component);
742 gPad->SetLogy();
743 fhMsSzTime[component]->Draw("hist le0");
744 } // if( NULL != fcMsSizeAll )
745 LOG(info) << "Added MS size histo for component: " << component << " (DPB)";
746 } // if( NULL == fhMsSz[ component ] )
747
748 // Int_t messageType = -111;
749 // Loop over microslices
750 size_t numCompMsInTs = ts.num_microslices(component);
751 /*
752 if( fulCurrentTsIdx + 1 != ts.index() && 0 == component)
753 LOG(info) << "Missed TS from " << fulCurrentTsIdx
754 << " to " << ts.index();
755*/
756 fulCurrentTsIdx = ts.index();
757
758 if (fuMaxNbMicroslices < numCompMsInTs) {
759 fuMaxNbMicroslices = numCompMsInTs;
760
765 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
766 fvuChanNbHitsInMs[uXyterIdx].resize(fuNbChanPerAsic);
767 fvdChanLastHitTimeInMs[uXyterIdx].resize(fuNbChanPerAsic);
768 fvusChanLastHitAdcInMs[uXyterIdx].resize(fuNbChanPerAsic);
769 for (UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan) {
770 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
771 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
772 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
773 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
774 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
775 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
776 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
777 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
778 } // for( UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan )
779 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
780 LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs.size()
781 << " VS " << fuNbStsXyters;
782 LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => Changed "
783 "fvuChanNbHitsInMs size "
784 << fvuChanNbHitsInMs[0].size() << " VS " << fuNbChanPerAsic;
785 LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => Changed "
786 "fvuChanNbHitsInMs size "
787 << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
788 } // if( fuMaxNbMicroslices < numCompMsInTs )
789
790 for (size_t m = 0; m < numCompMsInTs; ++m) {
791 // Ignore overlap ms if number defined by user
792 if (numCompMsInTs - fuOverlapMsNb <= m) continue;
793
794 auto msDescriptor = ts.descriptor(component, m);
795 fuCurrentEquipmentId = msDescriptor.eq_id;
796 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(component, m));
797
798 uint32_t size = msDescriptor.size;
799 fulCurrentMsIdx = msDescriptor.idx;
800 Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
801 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
802 << " has size: " << size;
803
804 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
806
807 if (component < kiMaxNbFlibLinks) {
808 if (fdStartTimeMsSz < 0) fdStartTimeMsSz = dMsTime;
809 fhMsSz[component]->Fill(size);
810 fhMsSzTime[component]->Fill(dMsTime - fdStartTimeMsSz, size);
811 } // if( component < kiMaxNbFlibLinks )
812
813 // Store MS time for coincidence plots
814 fvdMsTime[m] = dMsTime;
815
816 // If not integer number of message in input buffer, print warning/error
817 if (0 != (size % kuBytesPerMessage))
818 LOG(error) << "The input microslice buffer does NOT "
819 << "contain only complete nDPB messages!";
820
821 // Compute the number of complete messages in the input microslice buffer
822 uint32_t uNbMessages = (size - (size % kuBytesPerMessage)) / kuBytesPerMessage;
823
824 // Prepare variables for the loop on contents
825 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
826
827 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
828 // Fill message
829 uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
830
831 stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
832
833 // Print message if requested
834 if (fbPrintMessages) mess.PrintMess(std::cout, fPrintMessCtrl);
835
836 stsxyter::MessType typeMess = mess.GetMessType();
837 fmMsgCounter[typeMess]++;
838 fhPulserMessType->Fill(static_cast<uint16_t>(typeMess));
839 fhPulserMessTypePerDpb->Fill(fuCurrDpbIdx, static_cast<uint16_t>(typeMess));
840
841 switch (typeMess) {
843 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
844 UShort_t usElinkIdx = mess.GetLinkIndex();
845 if (fuNbElinksPerDpb <= usElinkIdx) {
846 LOG(fatal) << "CbmCosy2018MonitorPulser::DoUnpack => "
847 << "eLink index out of bounds!" << usElinkIdx << " VS " << fuNbElinksPerDpb;
848 } // if( fuNbElinksPerDpb <= usElinkIdx )
849 fhPulserMessTypePerElink->Fill(fuCurrDpbIdx * fuNbElinksPerDpb + usElinkIdx, static_cast<uint16_t>(typeMess));
850
851 UInt_t uAsicIdx = fvuElinkToAsic[fuCurrDpbIdx][usElinkIdx];
852
853 FillHitInfo(mess, usElinkIdx, uAsicIdx, m);
854 break;
855 } // case stsxyter::MessType::Hit :
857 FillTsMsbInfo(mess, uIdx, m);
858 break;
859 } // case stsxyter::MessType::TsMsb :
861 // The first message in the TS is a special ones: EPOCH
862 FillEpochInfo(mess);
863
864 if (0 < uIdx)
865 LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => "
866 << "EPOCH message at unexpected position in MS: message " << uIdx << " VS message 0 expected!";
867 break;
868 } // case stsxyter::MessType::TsMsb :
870 // FillTsMsbInfo( mess );
871 break;
872 } // case stsxyter::MessType::Empty :
874 break;
875 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
876 default: {
877 LOG(fatal) << "CbmCosy2018MonitorPulser::DoUnpack => "
878 << "Unknown message type, should never happen, stopping here!";
879 }
880 } // switch( mess.GetMessType() )
881 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
882 } // for( size_t m = 0; m < numCompMsInTs; ++m )
883
884 // End of TS, check if stuff to do with the hits inside each MS
885 // Usefull for low rate pulser tests
886 // Need to do it only when last DPB is processed, as they are done one by one
887 if (fuCurrDpbIdx == fuNrOfDpbs - 1) {
889 // Sort the buffer of hits
890 std::sort(fvmHitsInTs.begin(), fvmHitsInTs.end());
891
892 // Time differences plotting using the fully time sorted hits
893 if (0 < fvmHitsInTs.size()) {
894 ULong64_t ulLastHitTime = (*(fvmHitsInTs.rbegin())).GetTs();
895 std::vector<stsxyter::FinalHit>::iterator it;
896 std::vector<stsxyter::FinalHit>::iterator itB;
897
898 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
899 Double_t dUnixTimeInRun = std::chrono::duration_cast<std::chrono::seconds>(tNow - ftStartTimeUnix).count();
900
901 for (it = fvmHitsInTs.begin(); it != fvmHitsInTs.end();
902 // it != fvmHitsInTs.end() && (*it).GetTs() < ulLastHitTime - 320; // 320 * 3.125 ns = 1000 ns
903 ++it) {
904 UShort_t usAsicIdx = (*it).GetAsic();
905 UShort_t usChanIdx = (*it).GetChan();
906 ULong64_t ulHitTs = (*it).GetTs();
907 UShort_t usHitAdc = (*it).GetAdc();
908
909 Double_t dTimeSinceStartSec = (ulHitTs * stsxyter::kdClockCycleNs - fdStartTime) * 1e-9;
910
911 fvmAsicHitsInTs[usAsicIdx].push_back((*it));
912 } // loop on time sorted hits and split per asic
913
914 // Remove all hits which were already used
915 fvmHitsInTs.erase(fvmHitsInTs.begin(), it);
916
917 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
918 for (it = fvmAsicHitsInTs[uAsic].begin(); it != fvmAsicHitsInTs[uAsic].end(); ++it) {
919 UShort_t usChanIdx = (*it).GetChan();
920 if (0.0 == fdStartTs) fdStartTs = (*it).GetTs() * stsxyter::kdClockCycleNs;
921 Double_t dTimeSinceStartSec = ((*it).GetTs() * stsxyter::kdClockCycleNs - fdStartTs) * 1e-9;
922
923 for (UInt_t uAsicB = uAsic; uAsicB < fuNbStsXyters; uAsicB++) {
924 for (itB = fvmAsicHitsInTs[uAsicB].begin(); itB != fvmAsicHitsInTs[uAsicB].end(); ++itB) {
925 UShort_t usChanIdxB = (*itB).GetChan();
926 Double_t dDt = (static_cast<Double_t>((*itB).GetTs()) - static_cast<Double_t>((*it).GetTs()))
928
929 fhPulserTimeDiffPerAsic[uAsic]->Fill(dDt, uAsicB);
930 fhPulserTimeDiffPerAsicPair[uAsic][uAsicB]->Fill(dDt);
931 fhPulserTimeDiffEvoPerAsicPair[uAsic][uAsicB]->Fill(dTimeSinceStartSec, dDt);
932
933 fhPulserTsLsbMatchPerAsicPair[uAsic][uAsicB]->Fill((*it).GetTs() & 0x000FF, (*itB).GetTs() & 0x000FF);
934 fhPulserTsMsbMatchPerAsicPair[uAsic][uAsicB]->Fill(((*it).GetTs() & 0x03F00) >> 8,
935 ((*itB).GetTs() & 0x03F00) >> 8);
936 } // for( it = fvmAsicHitsInTs[ uAsicB ].begin(); it != fvmAsicHitsInTs[ uAsicB ].end(); ++it )
937 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
938
939 Double_t dDtPulse =
940 (static_cast<Double_t>((*it).GetTs()) - static_cast<Double_t>(fvmLastHitAsic[uAsic].GetTs()))
942 fhPulserIntervalAsic[uAsic]->Fill(dDtPulse);
943 fhPulserIntervalLongAsic[uAsic]->Fill(dDtPulse);
944 fvmLastHitAsic[uAsic] = (*it);
945 } // for( it = fvmAsicHitsInTs[ uAsic ].begin(); it != fvmAsicHitsInTs[ uAsic ].end(); ++it )
946
948 fvmAsicHitsInTs[uAsic].clear();
949 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
950 } // if( 0 < fvmHitsInTs.size() )
951
952 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
953 fvdMsTime[uMsIdx] = 0.0;
954 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
955 } // if( fuCurrDpbIdx == fuNrOfDpbs - 1 )
956
957 if (0 == ts.index() % 1000 && fuCurrDpbIdx == fuNrOfDpbs - 1) {
958 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
959 Double_t dTsMsbTime =
960 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
961 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
962 * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
963 dTsMsbTime *= stsxyter::kdClockCycleNs * 1e-9;
964
965 LOG(info) << "End of TS " << std::setw(7) << ts.index() << " eDPB " << std::setw(2) << uDpb
966 << " current TS MSB counter is " << std::setw(12) << fvulCurrentTsMsb[uDpb]
967 << " current TS MSB cycle counter is " << std::setw(12) << fvuCurrentTsMsbCycle[uDpb]
968 << " current TS MSB time is " << std::setw(12) << dTsMsbTime << " s";
969 }
970 } // if( 0 == ts.index() % 1000 && fuCurrDpbIdx == fuNrOfDpbs - 1 )
971
972 return kTRUE;
973}
974
975void CbmCosy2018MonitorPulser::FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx,
976 const UInt_t& uMsIdx)
977{
978 UShort_t usChan = mess.GetHitChannel();
979 UShort_t usRawAdc = mess.GetHitAdc();
980 // UShort_t usFullTs = mess.GetHitTimeFull();
981 UShort_t usTsOver = mess.GetHitTimeOver();
982 UShort_t usRawTs = mess.GetHitTime();
983
984 fhPulserChanCntRaw[uAsicIdx]->Fill(usChan);
985 fhPulserChanAdcRaw[uAsicIdx]->Fill(usChan, usRawAdc);
986 fhPulserChanAdcRawProf[uAsicIdx]->Fill(usChan, usRawAdc);
987 fhPulserChanRawTs[uAsicIdx]->Fill(usChan, usRawTs);
988 fhPulserChanMissEvt[uAsicIdx]->Fill(usChan, mess.IsHitMissedEvts());
989
990 // Compute the Full time stamp
991 Long64_t ulOldHitTime = fvulChanLastHitTime[uAsicIdx][usChan];
992 Double_t dOldHitTime = fvdChanLastHitTime[uAsicIdx][usChan];
993
994 // Use TS w/o overlap bits as they will anyway come from the TS_MSB
995 fvulChanLastHitTime[uAsicIdx][usChan] = usRawTs;
996
997 fvulChanLastHitTime[uAsicIdx][usChan] +=
998 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
999 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins) * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1000
1001 // fvuElinkLastTsHit[fuCurrDpbIdx] = usRawTs;
1002
1003 // Convert the Hit time in bins to Hit time in ns
1004 Double_t dHitTimeNs = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1005 /*
1006 // If needed fill the hit interval plots
1007 if( fbChanHitDtEna )
1008 {
1009 Double_t dDeltaT = dHitTimeNs - fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1010 if( 0 == dDeltaT )
1011 fhStsChanHitDtNeg[ uAsicIdx ]->Fill( 1, usChan );
1012 else if( 0 < dDeltaT )
1013 fhStsChanHitDt[ uAsicIdx ]->Fill( dDeltaT, usChan );
1014 else fhStsChanHitDtNeg[ uAsicIdx ]->Fill( -dDeltaT, usChan );
1015 } // if( fbChanHitDtEna )
1016*/
1017 // Store new value of Hit time in ns
1018 fvdChanLastHitTime[uAsicIdx][usChan] = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1019 /*
1020 LOG(info) << " Asic " << std::setw( 2 ) << uAsicIdx
1021 << " Channel " << std::setw( 3 ) << usChan
1022 << " Diff to last hit " << std::setw( 12 ) << ( fvulChanLastHitTime[ uAsicIdx ][ usChan ] - ulOldHitTime)
1023 << " in s " << std::setw( 12 ) << ( fvdChanLastHitTime[ uAsicIdx ][ usChan ] - dOldHitTime) * 1e-9;
1024*/
1025 // Pulser and MS
1026 fvuChanNbHitsInMs[uAsicIdx][usChan][uMsIdx]++;
1027 fvdChanLastHitTimeInMs[uAsicIdx][usChan][uMsIdx] = dHitTimeNs;
1028 fvusChanLastHitAdcInMs[uAsicIdx][usChan][uMsIdx] = usRawAdc;
1029 /*
1030 fvmChanHitsInTs[ uAsicIdx ][ usChan ].insert( stsxyter::FinalHit( fvulChanLastHitTime[ uAsicIdx ][ usChan ],
1031 usRawAdc, uAsicIdx, usChan ) );
1032*/
1033 fvmHitsInTs.push_back(stsxyter::FinalHit(fvulChanLastHitTime[uAsicIdx][usChan], usRawAdc, uAsicIdx, usChan));
1034
1035 /*
1036 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1037 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1038 << " MsInTs " << std::setw( 3 ) << uMsIdx
1039 << " Asic " << std::setw( 2 ) << uAsicIdx
1040 << " Channel " << std::setw( 3 ) << usChan
1041 << " ADC " << std::setw( 3 ) << usRawAdc
1042 << " TS " << std::setw( 3 ) << usRawTs // 9 bits TS
1043 << " SX TsMsb " << std::setw( 2 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b TS_MSB after DPB
1044 << " DPB TsMsb " << std::setw( 6 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b of TS_MSB after DPB
1045 << " TsMsb " << std::setw( 7 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1046 << " MsbCy " << std::setw( 4 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
1047 << " Time " << std::setw ( 12 ) << fvulChanLastHitTime[ uAsicIdx ][ usChan ];
1048*/
1049 // Check Starting point of histos with time as X axis
1050 if (-1 == fdStartTime) fdStartTime = fvdChanLastHitTime[uAsicIdx][usChan];
1051
1052 // Fill histos with time as X axis
1053 Double_t dTimeSinceStartSec = (fvdChanLastHitTime[uAsicIdx][usChan] - fdStartTime) * 1e-9;
1054 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1055 fhPulserChanHitRateEvo[uAsicIdx]->Fill(dTimeSinceStartSec, usChan);
1056 fhPulserFebRateEvo[uAsicIdx]->Fill(dTimeSinceStartSec);
1057 fhPulserChanHitRateEvoLong[uAsicIdx]->Fill(dTimeSinceStartMin, usChan, 1.0 / 60.0);
1058 fhPulserFebRateEvoLong[uAsicIdx]->Fill(dTimeSinceStartMin, 1.0 / 60.0);
1059 if (mess.IsHitMissedEvts()) {
1060 fhPulserChanMissEvtEvo[uAsicIdx]->Fill(dTimeSinceStartSec, usChan);
1061 fhPulserFebMissEvtEvo[uAsicIdx]->Fill(dTimeSinceStartSec);
1062 } // if( mess.IsHitMissedEvts() )
1063 /*
1064 if( kTRUE == fbLongHistoEnable )
1065 {
1066 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
1067 Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
1068 fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
1069 fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
1070 } // if( kTRUE == fbLongHistoEnable )
1071*/
1072}
1073
1074void CbmCosy2018MonitorPulser::FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx, UInt_t uMsIdx)
1075{
1076 UInt_t uVal = mess.GetTsMsbVal();
1077 /*
1078 if( 0 == fuCurrDpbIdx )
1079 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1080 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1081 << " MsInTs " << std::setw( 3 ) << uMsIdx
1082 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1083 << " Mess " << std::setw( 5 ) << uMessIdx
1084 << " TsMsb " << std::setw( 5 ) << uVal;
1085*/
1086 /*
1087 if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal &&
1088 !( 1 == uMessIdx && usVal == fvulCurrentTsMsb[fuCurrDpbIdx] ) ) // 1st TS_MSB in MS is always a repeat of the last one in previous MS!
1089 {
1090 LOG(info) << "TS MSB not increasing by 1! TS " << std::setw( 12 ) << fulCurrentTsIdx
1091 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1092 << " MsInTs " << std::setw( 3 ) << uMsIdx
1093 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1094 << " Mess " << std::setw( 5 ) << uMessIdx
1095 << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1096 << " new TsMsb " << std::setw( 5 ) << uVal
1097 << " Diff " << std::setw( 5 ) << uVal - fvulCurrentTsMsb[fuCurrDpbIdx]
1098 << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
1099 } // if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal )
1100*/
1101
1102 // Update Status counters
1103 if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
1104
1105 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " DPB "
1106 << std::setw(2) << fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx]
1107 << " Old MsbCy " << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " new TsMsb " << std::setw(5)
1108 << uVal;
1109
1111 } // if( uVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
1113 /*
1114 if( 1 < uMessIdx )
1115 {
1116 fhStsDpbRawTsMsb->Fill( fuCurrDpbIdx, fvulCurrentTsMsb[fuCurrDpbIdx] );
1117 fhStsDpbRawTsMsbSx->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) );
1118 fhStsDpbRawTsMsbDpb->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) );
1119 } // if( 0 < uMessIdx )
1120*/
1121 // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
1122
1123 ULong64_t ulNewTsMsbTime =
1124 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1125 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins) * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1126}
1127
1129{
1130 UInt_t uVal = mess.GetTsMsbVal();
1131 /*
1132 // Update Status counters
1133 if( usVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
1134 fvuCurrentTsMsbCycle[fuCurrDpbIdx] ++;
1135 fvulCurrentTsMsb[fuCurrDpbIdx] = usVal;
1136
1137// fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
1138*/
1139}
1140
1142
1144{
1145
1146 LOG(info) << "-------------------------------------";
1147 LOG(info) << "CbmCosy2018MonitorPulser statistics are ";
1148 LOG(info) << " Hit messages: " << fmMsgCounter[stsxyter::MessType::Hit] << "\n"
1149 << " Ts MSB messages: " << fmMsgCounter[stsxyter::MessType::TsMsb] << "\n"
1150 << " Dummy messages: " << fmMsgCounter[stsxyter::MessType::Dummy] << "\n"
1151 << " Epoch messages: " << fmMsgCounter[stsxyter::MessType::Epoch] << "\n"
1152 << " Empty messages: " << fmMsgCounter[stsxyter::MessType::Empty];
1153
1154 LOG(info) << "-------------------------------------";
1155
1157 SaveAllHistos();
1158}
1159
1160
1162{
1164 TFile* oldFile = gFile;
1165 TDirectory* oldDir = gDirectory;
1166
1167 TFile* histoFile = NULL;
1168 if ("" != sFileName) {
1169 // open separate histo file in recreate mode
1170 histoFile = new TFile(sFileName, "RECREATE");
1171 histoFile->cd();
1172 } // if( "" != sFileName )
1173
1174 /***************************/
1175 gDirectory->mkdir("Sts_Raw");
1176 gDirectory->cd("Sts_Raw");
1177
1178 fhPulserMessType->Write();
1179 fhPulserSysMessType->Write();
1180 fhPulserMessTypePerDpb->Write();
1182 fhPulserMessTypePerElink->Write();
1184
1185 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1186 fhPulserChanCntRaw[uXyterIdx]->Write();
1187 fhPulserChanAdcRaw[uXyterIdx]->Write();
1188 fhPulserChanAdcRawProf[uXyterIdx]->Write();
1189 fhPulserChanRawTs[uXyterIdx]->Write();
1190 fhPulserChanMissEvt[uXyterIdx]->Write();
1191 fhPulserChanMissEvtEvo[uXyterIdx]->Write();
1192 fhPulserFebMissEvtEvo[uXyterIdx]->Write();
1193 fhPulserChanHitRateEvo[uXyterIdx]->Write();
1194 fhPulserFebRateEvo[uXyterIdx]->Write();
1195 fhPulserChanHitRateEvoLong[uXyterIdx]->Write();
1196 fhPulserFebRateEvoLong[uXyterIdx]->Write();
1197 /*
1198 if( kTRUE == fbLongHistoEnable )
1199 {
1200 fhFebRateEvoLong[ uXyterIdx ]->Write();
1201 fhFebChRateEvoLong[ uXyterIdx ]->Write();
1202 } // if( kTRUE == fbLongHistoEnable )
1203*/
1204 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1205
1206 gDirectory->cd("..");
1207 /***************************/
1208
1209 /***************************/
1210 // Flib Histos
1211 gDirectory->mkdir("Flib_Raw");
1212 gDirectory->cd("Flib_Raw");
1213 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; uLinks++) {
1214 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1215 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Write();
1216
1217 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1218 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Write();
1219 } // for( UInt_t uLinks = 0; uLinks < 16; uLinks ++)
1220
1221 TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
1222 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1223
1224 TProfile* pMissedTsEvoP = dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
1225 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1226
1227 gDirectory->cd("..");
1228 /***************************/
1229
1230 if ("" != sFileName) {
1231 // Restore original directory position
1232 histoFile->Close();
1233 } // if( "" != sFileName )
1234
1236 gFile = oldFile;
1237 gDirectory = oldDir;
1238}
1240{
1241 LOG(info) << "Reseting all STS histograms.";
1242
1243 fhPulserMessType->Reset();
1244 fhPulserSysMessType->Reset();
1245 fhPulserMessTypePerDpb->Reset();
1247 fhPulserMessTypePerElink->Reset();
1249
1250 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1251 fhPulserChanCntRaw[uXyterIdx]->Reset();
1252 fhPulserChanAdcRaw[uXyterIdx]->Reset();
1253 fhPulserChanAdcRawProf[uXyterIdx]->Reset();
1254 fhPulserChanRawTs[uXyterIdx]->Reset();
1255 fhPulserChanMissEvt[uXyterIdx]->Reset();
1256 fhPulserChanMissEvtEvo[uXyterIdx]->Reset();
1257 fhPulserFebMissEvtEvo[uXyterIdx]->Reset();
1258 fhPulserChanHitRateEvo[uXyterIdx]->Reset();
1259 fhPulserFebRateEvo[uXyterIdx]->Reset();
1260 fhPulserChanHitRateEvoLong[uXyterIdx]->Reset();
1261 fhPulserFebRateEvoLong[uXyterIdx]->Reset();
1262 /*
1263 if( kTRUE == fbLongHistoEnable )
1264 {
1265 ftStartTimeUnix = std::chrono::steady_clock::now();
1266 fhFebRateEvoLong[ uXyterIdx ]->Reset();
1267 fhFebChRateEvoLong[ uXyterIdx ]->Reset();
1268 } // if( kTRUE == fbLongHistoEnable )
1269*/
1270
1271 fhPulserTimeDiffPerAsic[uXyterIdx]->Reset();
1272 for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
1273 fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1274 fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1275 fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1276 fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1277 } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1278 fhPulserIntervalAsic[uXyterIdx]->Reset();
1279 fhPulserIntervalLongAsic[uXyterIdx]->Reset();
1280 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1281
1282 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks) {
1283 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1284 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Reset();
1285
1286 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1287 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Reset();
1288 } // for( UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks )
1289
1290 fdStartTime = -1;
1291 fdStartTimeMsSz = -1;
1292}
1293
1295{
1296 TDatime* fRunStartDateTime = new TDatime(dateIn, timeIn);
1297 fiRunStartDateTimeSec = fRunStartDateTime->Convert();
1298 fiBinSizeDatePlots = iBinSize;
1299
1300 LOG(info) << "Assigned new MUCH Run Start Date-Time: " << fRunStartDateTime->AsString();
1301}
1302
1303void CbmCosy2018MonitorPulser::SetLongDurationLimits(UInt_t uDurationSeconds, UInt_t uBinSize)
1304{
1305 fbLongHistoEnable = kTRUE;
1306 fuLongHistoNbSeconds = uDurationSeconds;
1307 fuLongHistoBinSizeSec = uBinSize;
1308}
1309
ClassImp(CbmConverterManager)
Histogram manager.
Bool_t bCosy2018ResetPulser
Bool_t bCosy2018WritePulser
static constexpr size_t size()
Definition KfSimdPseudo.h:2
int Int_t
bool Bool_t
std::vector< UInt_t > fvuElinkLastTsHit
Current TS MSB cycle for DPB.
Double_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
UInt_t fuNbChanPerAsic
Number of StsXyter ASICs.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
stsxyter::MessagePrintMask fPrintMessCtrl
CbmCern2017UnpackParHodo * fUnpackParHodo
std::vector< std::vector< TH1 * > > fhPulserTimeDiffPerAsicPair
std::vector< TH2 * > fhPulserChanMissEvtEvo
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< std::vector< TH2 * > > fhPulserTsLsbMatchPerAsicPair
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of Sts DPBs in system.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
std::vector< TH1 * > fhPulserChanCntRawGood
std::vector< Double_t > fvdMsTime
Last hit time in ns for each Channel.
std::chrono::steady_clock::time_point ftStartTimeUnix
std::vector< TH1 * > fhPulserIntervalLongAsic
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TS from last hit for DPB.
void FillEpochInfo(stsxyter::Message mess)
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
std::vector< TH2 * > fhPulserTimeDiffPerAsic
Last hits in each ASIC.
std::vector< std::vector< TH2 * > > fhPulserTsMsbMatchPerAsicPair
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< stsxyter::FinalHit > fvmLastHitAsic
Last hits in each ASIC.
Double_t fdStartTs
Pulser time difference histos.
std::vector< TH2 * > fhPulserChanHitRateEvoLong
std::vector< std::vector< UInt_t > > fvuElinkToAsic
Number of channels per StsXyter ASIC => should be constant somewhere!!!!
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH1 * > fhPulserFebRateEvoLong
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< stsxyter::FinalHit > fvmHitsInTs
std::vector< std::vector< TH2 * > > fhPulserTimeDiffEvoPerAsicPair
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
std::vector< TProfile * > fhPulserChanAdcRawProf
UInt_t fuNbElinksPerDpb
Map of DPB Identifier to DPB index.
UInt_t fuMaxNbMicroslices
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
UInt_t fuNbStsXyters
Number of possible eLinks per DPB.
static const Int_t kiMaxNbFlibLinks
Vector holding for each link the corresponding ASIC index [fuNrOfDpbs * fuNbElinksPerDpb].
std::vector< TH2 * > fhPulserChanHitRateEvo
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
TH1 * fhPulserMessType
Histogram manager.
void SaveAllHistos(TString sFileName="")
Histogram manager.
Data class with information on a STS local track.
XPU_D bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
XPU_D uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
XPU_D uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human, bool bBinning=true) const
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
XPU_D uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
XPU_D uint16_t GetHitTimeOver() const
For Hit data: Returns timestamp overlap bits (2 bits field, overlap with 2 LSBs of TS_MSB message)
Hash for CbmL1LinkKey.
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs
MessType
Message types.