9#include "svd/modules/svdDQM/SVDUnpackerDQMModule.h"
10#include <svd/online/SVDOnlineToOfflineMap.h>
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/datastore/StoreArray.h>
15#include <svd/dataobjects/SVDDAQDiagnostic.h>
17#include <TDirectory.h>
46 std::string(
"SVDUnpacker"));
54SVDUnpackerDQMModule::~SVDUnpackerDQMModule()
66 TDirectory* oldDir = gDirectory;
72 const unsigned short Bins_FTBFlags = 5;
73 const unsigned short Bins_FTBError = 4;
74 const unsigned short Bins_APVError = 4;
75 const unsigned short Bins_APVMatch = 1;
76 const unsigned short Bins_FADCMatch = 1;
77 const unsigned short Bins_UpsetAPV = 1;
78 const unsigned short Bins_BadMapping = 1;
79 const unsigned short Bins_BadHeader = 1;
80 const unsigned short Bins_MissedTrailer = 1;
81 const unsigned short Bins_MissedHeader = 1;
84 const unsigned short nBits = Bins_FTBFlags + Bins_FTBError + Bins_APVError + Bins_APVMatch + Bins_FADCMatch + Bins_UpsetAPV +
85 Bins_BadMapping + Bins_BadHeader + Bins_MissedTrailer + Bins_MissedHeader;
87 m_DQMUnpackerHisto =
new TH2F(
"DQMUnpackerHisto",
"SVD Data Format Monitor", nBits, 1, nBits + 1, 52, 1, 53);
89 m_DQMnSamplesHisto =
new TH2F(
"DQMnSamplesHisto",
"nAPVsamples VS DAQMode", 3, 1, 4, 2, 1, 3);
90 m_DQMnSamplesHisto2 =
new TH2F(
"DQMnSamplesHisto2",
"nAPVsamples VS DAQMode", 2, 1, 3, 2, 1, 3);
91 m_DQMtrgQuality =
new TH2F(
"DQMtrgQuality",
"nAPVsamples VS trgQuality", 4, 1, 5, 2, 1, 3);
109 TString Xlabels[nBits] = {
"EvTooLong",
"TimeOut",
"doubleHead",
"badEvt",
"errCRC",
"badFADC",
"badTTD",
"badFTB",
"badALL",
"errAPV",
"errDET",
"errFrame",
"errFIFO",
"APVmatch",
"FADCmatch",
"upsetAPV",
"EVTmatch",
"missHead",
"missTrail",
"badMapping"};
111 TString Ysamples[2] = {
"3",
"6"};
112 TString Xsamples[3] = {
"3 samples",
"6 samples",
"3/6 mixed"};
114 TString Xquality[4] = {
"coarse",
"fine",
"super fine",
"no TRGSummary"};
117 for (
unsigned short i = 0; i < nBits; i++)
m_DQMUnpackerHisto->GetXaxis()->SetBinLabel(i + 1, Xlabels[i].Data());
120 for (
unsigned short i = 0; i < 3; i++)
m_DQMnSamplesHisto->GetXaxis()->SetBinLabel(i + 1, Xsamples[i].Data());
121 for (
unsigned short i = 0; i < 2; i++)
m_DQMnSamplesHisto2->GetXaxis()->SetBinLabel(i + 1, Xsamples[i].Data());
123 for (
unsigned short i = 0; i < 2; i++)
m_DQMnSamplesHisto->GetYaxis()->SetBinLabel(i + 1, Ysamples[i].Data());
124 for (
unsigned short i = 0; i < 2; i++)
m_DQMnSamplesHisto2->GetYaxis()->SetBinLabel(i + 1, Ysamples[i].Data());
127 for (
unsigned short i = 0; i < 4; i++)
m_DQMtrgQuality->GetXaxis()->SetBinLabel(i + 1, Xquality[i].Data());
128 for (
unsigned short i = 0; i < 2; i++)
m_DQMtrgQuality->GetYaxis()->SetBinLabel(i + 1, Ysamples[i].Data());
161 Int_t pos = tmp.Last(
'~');
162 if (pos == -1) pos = tmp.Length() + 2;
163 TString title = tmp(0, pos - 2);
170 Int_t pos = tmp.Last(
'~');
171 if (pos == -1) pos = tmp.Length() + 2;
172 TString title = tmp(0, pos - 2);
179 Int_t pos = tmp.Last(
'~');
180 if (pos == -1) pos = tmp.Length() + 2;
181 TString title = tmp(0, pos - 2);
188 Int_t pos = tmp.Last(
'~');
189 if (pos == -1) pos = tmp.Length() + 2;
190 TString title = tmp(0, pos - 2);
197 Int_t pos = tmp.Last(
'~');
198 if (pos == -1) pos = tmp.Length() + 2;
199 TString title = tmp(0, pos - 2);
217 unsigned short ifadc = 0;
232 B2WARNING(
"There are no SVDDAQDiagnostic objects saved by the Unpacker! SVD Data Format Monitoring disabled!");
239 B2WARNING(
"There is no SVDEventInfo object saved by the Unpacker! SVD Data Format Monitoring disabled!");
266 unsigned short bin_no = 0;
267 gStyle->SetOptStat(0);
269 for (
unsigned short i = 0; i < nDiagnostics; i++) {
370 B2WARNING(
"=================== SVD DQM Data Format Statistics: =============");
373 B2WARNING(
"=================================================================");
HistoModule()
Constructor.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
unsigned int m_nBadEvents
counter of events with any kind of error
void initialize() override final
Module function initialize.
TH2F * m_DQMnSamplesHisto2
TH2F histogram showing number of samples in data VS daqMode (2bins only)
int m_runNumber
run number
bool m_badTrailer
bad trailer error
unsigned int m_nEvents
event counter
StoreObjPtr< SVDEventInfo > m_svdEventInfo
SVDEventInfo StoreObjectPointer.
bool m_missedHeader
missed Header error
bool m_shutUpNoData
shut up if no data comes
TH2F * m_DQMUnpackerHisto
TH2F histogram with Unpacking errors.
std::string m_SVDDAQDiagnosticsName
SVD diagnostics module name.
SVDUnpackerDQMModule()
Constructor.
int m_expNumber
experiment number
StoreArray< SVDDAQDiagnostic > m_svdDAQDiagnostics
SVDDAQDiagnostic StoreArray.
std::vector< unsigned short > m_vec_fadc
vector of FADC boards
std::unordered_map< unsigned short, unsigned short > m_fadc_map
FADC board number map.
void defineHisto() override final
Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
DBObjPtr< PayloadFile > m_mapping
channel map payload
float m_errorFraction
fraction of events with any kind of error
TH2F * m_DQMnSamplesHisto
TH2F histogram showing number of samples in data VS daqMode.
TH1F * m_DQMEventFractionHisto
TH1F histogram showing the fraction of events affected by errors.
StoreObjPtr< EventMetaData > m_eventMetaData
EvtMetaData StoreObjectPointer.
static std::string m_xmlFileName
xml filename
bool m_badHeader
bad header error
bool m_upsetAPV
upset APV error
void event() override final
Module function event.
StoreObjPtr< TRGSummary > m_objTrgSummary
Trigger Summary data object.
std::string m_histogramDirectoryName
Name of the histogram directory in ROOT file.
bool m_missedTrailer
missed Trailer error
std::unordered_set< unsigned char > * m_FADCs
FADC boards number.
TH2F * m_DQMtrgQuality
TH2F histogram showing number of samples in data VS Trigger Quality.
void endRun() override final
Module function endRun.
bool m_badMapping
bad mapping error
uint16_t m_apvError
APV error container.
std::string m_SVDEventInfoName
SVDEventInfo name.
unsigned short m_fadcNo
fadc number
bool m_fadcMatch
fadcc match error
void beginRun() override final
Module function beginRun.
bool m_badEvent
indicates if the particular event has any SVD error
std::unique_ptr< SVDOnlineToOfflineMap > m_map
mapping implementation
uint16_t m_ftbError
FTB error container.
uint16_t m_ftbFlags
FTB flags container.
bool m_changeFADCaxis
change FADC (y) axis
bool m_apvMatch
apv match error
Type-safe access to single objects in the data store.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.