Belle II Software development
eclDQMConnectedRegions.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/* Own header. */
10#include <ecl/modules/eclDQMConnectedRegions/eclDQMConnectedRegions.h>
11
12/* Basf2 headers. */
13#include <framework/core/HistoModule.h>
14#include <framework/datastore/StoreArray.h>
15#include <ecl/dataobjects/ECLConnectedRegion.h>
16#include <ecl/dataobjects/ECLLocalMaximum.h>
17#include <ecl/dataobjects/ECLCalDigit.h>
18
19/* ROOT headers. */
20#include <TDirectory.h>
21
22/* C++ headers. */
23#include <string>
24
25//NAMESPACE(S)
26using namespace Belle2;
27
28REG_MODULE(ECLDQMConnectedRegions);
29
31 : HistoModule()
32{
33 //Set module properties.
34 setDescription("ECL Data Quality Monitor to monitor ECL Connected Regions");
35 setPropertyFlags(c_ParallelProcessingCertified); // specify parallel processing.
36
37 addParam("histogramDirectoryName", m_histogramDirectoryName,
38 "histogram directory in ROOT file", std::string("ECL"));
39}
40
42{
43 TDirectory* oldDir = gDirectory;
44
45 // Create a separate histogram directory and cd into it.
46 TDirectory* dirDAQ = dynamic_cast<TDirectory*>(oldDir->Get(m_histogramDirectoryName.c_str()));
47 if (!dirDAQ) dirDAQ = oldDir->mkdir(m_histogramDirectoryName.c_str());
48 dirDAQ->cd();
49
50 m_largestCRCrystalsNum = new TH1F("Crystals_distribution_in_largest_cr", "Crystals distribution in largest ECLConnectedRegions",
51 1000, 0,
52 2000);
53 m_largestCRLocalMaxNum = new TH1F("LocalMaximum_distribution_in_largest_cr", "LocalMaximum distribution in ECLConnectedRegion",
54 1000, 0,
55 2000);
56
57 //cd into parent directory.
58 oldDir->cd();
59}
60
62{
63 REG_HISTOGRAM; // required to register histograms to HistoManager.
64}
65
67{
70}
71
73{
74 StoreArray<ECLConnectedRegion> ecl_connected_regions;
75 size_t max_crystals = 0;
76 size_t localmax_in_largest_cr = 0;
77 for (auto& region : ecl_connected_regions) {
78 auto cr_crystals_num = region.getRelationsWith<ECLCalDigit>().size();
79 auto cr_localmax_num = region.getRelationsWith<ECLLocalMaximum>().size();
80 if (cr_crystals_num > max_crystals) {
81 max_crystals = cr_crystals_num;
82 localmax_in_largest_cr = cr_localmax_num;
83 }
84 }
85 m_largestCRCrystalsNum->Fill(max_crystals);
86 m_largestCRLocalMaxNum->Fill(localmax_in_largest_cr);
87}
Class to store calibrated ECLDigits: ECLCalDigits.
Definition: ECLCalDigit.h:23
TH1F * m_largestCRCrystalsNum
Histogram to hold number of crystals in largest ECL connected region.
ECLDQMConnectedRegionsModule()
< derived from HistoModule class.
virtual void initialize() override
Initialize the module.
virtual void event() override
Event processor.
virtual void beginRun() override
Call when a run begins.
std::string m_histogramDirectoryName
Histogram directory in ROOT file.
TH1F * m_largestCRLocalMaxNum
Histogram to hold number of local maximum in ECL connected region.
virtual void defineHisto() override
Function to define histograms.
Class to store local maxima (LM)
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
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
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
Abstract base class for different kinds of events.