Belle II Software development
PXDGatedDHCDQMModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <pxd/modules/pxdDQM/PXDGatedDHCDQMModule.h>
10#include <pxd/dataobjects/PXDDAQStatus.h>
11#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
12#include "TDirectory.h"
13
14using namespace std;
15using namespace Belle2;
16using namespace Belle2::PXD;
17
18//-----------------------------------------------------------------
19// Register the Module
20//-----------------------------------------------------------------
21REG_MODULE(PXDGatedDHCDQM);
22
23//-----------------------------------------------------------------
24// Implementation
25//-----------------------------------------------------------------
26
28{
29 //Set module properties
30 setDescription("Monitor Gating after Injection");
32 addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms will be placed",
33 std::string("PXDINJ"));
34}
35
37{
38 TDirectory* oldDir = gDirectory;
39 oldDir->mkdir(m_histogramDirectoryName.c_str());// do not rely on return value, might be ZERO
40 oldDir->cd(m_histogramDirectoryName.c_str());//changing to the right directory
41
42 hGateAfterInjLER = new TH2F("PXDGateingInjLER", "PXDGateingInjLER/Time;Time in #mus;Flags", 100000, 0, 50000, 64, 0, 64);
43 hGateAfterInjHER = new TH2F("PXDGateingInjHER", "PXDGateingInjHER/Time;Time in #mus;Flags", 100000, 0, 50000, 64, 0, 64);
44 // cd back to root directory
45 oldDir->cd();
46}
47
49{
50 REG_HISTOGRAM
51 m_storeDAQEvtStats.isRequired();
52 m_EventLevelTriggerTimeInfo.isRequired();
53}
54
56{
57 // Assume that everything is non-zero ;-)
58 hGateAfterInjLER->Reset();
59 hGateAfterInjHER->Reset();
60}
61
63{
64
65 // And check if the stored data is valid
66 if (m_EventLevelTriggerTimeInfo.isValid() and m_EventLevelTriggerTimeInfo->isValid()) {
67
68 // check time overflow, too long ago
69 if (m_EventLevelTriggerTimeInfo->hasInjection()) {
70 // get last injection time
71 float difference = m_EventLevelTriggerTimeInfo->getTimeSinceLastInjection() / 127.; // 127MHz clock ticks to us, inexact rounding
72 bool isher = m_EventLevelTriggerTimeInfo->isHER();
73 for (auto& pkt : *m_storeDAQEvtStats) {
74 for (auto& dhc : pkt) {
75 int value = dhc.getDHCID() * 4 + dhc.getGatedFlag() * 2 + dhc.getGatedHER();
76 if (isher) {
77 hGateAfterInjHER->Fill(difference, value);
78 } else {
79 hGateAfterInjLER->Fill(difference, value);
80 }
81 }
82 }
83 }
84 }
85}
HistoModule()
Constructor.
Definition HistoModule.h:32
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
void initialize() override final
initialize function
TH2F * hGateAfterInjHER
Histogram after HER injection.
StoreObjPtr< PXDDAQStatus > m_storeDAQEvtStats
Input array for DAQ Status.
TH2F * hGateAfterInjLER
Histogram after LER injection.
void defineHisto() override final
defineHisto function
void event() override final
event function
std::string m_histogramDirectoryName
Name of the histogram directory in ROOT file.
void beginRun() override final
beginRun function
StoreObjPtr< EventLevelTriggerTimeInfo > m_EventLevelTriggerTimeInfo
Object for TTD mdst object.
PXDGatedDHCDQMModule()
Constructor defining the parameters.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.
STL namespace.