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 "TDirectory.h"
11
12using namespace std;
13using namespace Belle2;
14using namespace Belle2::PXD;
15
16//-----------------------------------------------------------------
17// Register the Module
18//-----------------------------------------------------------------
19REG_MODULE(PXDGatedDHCDQM);
20
21//-----------------------------------------------------------------
22// Implementation
23//-----------------------------------------------------------------
24
26{
27 //Set module properties
28 setDescription("Monitor Gating after Injection");
30 addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms will be placed",
31 std::string("PXDINJ"));
32}
33
35{
36 TDirectory* oldDir = gDirectory;
37 oldDir->mkdir(m_histogramDirectoryName.c_str());// do not rely on return value, might be ZERO
38 oldDir->cd(m_histogramDirectoryName.c_str());//changing to the right directory
39
40 hGateAfterInjLER = new TH2F("PXDGateingInjLER", "PXDGateingInjLER/Time;Time in #mus;Flags", 100000, 0, 50000, 64, 0, 64);
41 hGateAfterInjHER = new TH2F("PXDGateingInjHER", "PXDGateingInjHER/Time;Time in #mus;Flags", 100000, 0, 50000, 64, 0, 64);
42 // cd back to root directory
43 oldDir->cd();
44}
45
47{
48 REG_HISTOGRAM
49 m_storeDAQEvtStats.isRequired();
50 m_EventLevelTriggerTimeInfo.isRequired();
51}
52
54{
55 // Assume that everthing is non-zero ;-)
56 hGateAfterInjLER->Reset();
57 hGateAfterInjHER->Reset();
58}
59
61{
62
63 // And check if the stored data is valid
64 if (m_EventLevelTriggerTimeInfo.isValid() and m_EventLevelTriggerTimeInfo->isValid()) {
65
66 // check time overflow, too long ago
67 if (m_EventLevelTriggerTimeInfo->hasInjection()) {
68 // get last injection time
69 float difference = m_EventLevelTriggerTimeInfo->getTimeSinceLastInjection() / 127.; // 127MHz clock ticks to us, inexact rounding
70 bool isher = m_EventLevelTriggerTimeInfo->isHER();
71 for (auto& pkt : *m_storeDAQEvtStats) {
72 for (auto& dhc : pkt) {
73 int value = dhc.getDHCID() * 4 + dhc.getGatedFlag() * 2 + dhc.getGatedHER();
74 if (isher) {
75 hGateAfterInjHER->Fill(difference, value);
76 } else {
77 hGateAfterInjLER->Fill(difference, value);
78 }
79 }
80 }
81 }
82 }
83}
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.
STL namespace.