10#include <klm/modules/KLMChannelStatusCollector/KLMChannelStatusCollectorModule.h>
13#include <klm/dataobjects/KLMChannelIndex.h>
14#include <klm/dataobjects/KLMChannelMapValue.h>
29 m_HitMap(
"KLMChannelMapHits",
DataStore::c_Persistent)
31 setDescription(
"Module for KLM channel status calibration (data collection).");
45 TTree* calibrationData =
new TTree(
"calibration_data",
"");
46 registerObject<TTree>(
"calibration_data", calibrationData);
53 if (digit.isMultiStrip())
57 digit.getSubdetector(), digit.getSection(), digit.getSector(),
58 digit.getLayer(), digit.getPlane(), digit.getStrip());
67 TTree* calibrationData = getObjectPtr<TTree>(
"calibration_data");
68 calibrationData->Branch(
"channel", &channel,
"channel/s");
69 calibrationData->Branch(
"hits", &hits,
"hits/i");
72 channel = klmChannel.getKLMChannelNumber();
73 hits =
m_HitMap->getChannelData(channel);
74 calibrationData->Fill();
83 std::string histogramName;
84 TFile* f =
new TFile(dqmFile);
92 for (
int j = 0; j < nHistograms; ++j) {
93 histogramName =
"KLM/strip_hits_subdetector_" +
94 std::to_string(klmSector.getSubdetector()) +
95 "_section_" + std::to_string(klmSector.getSection()) +
96 "_sector_" + std::to_string(klmSector.getSector()) +
97 "_" + std::to_string(j);
98 TH1* histogram = (TH1*)f->Get(histogramName.c_str());
99 if (histogram ==
nullptr) {
100 B2ERROR(
"KLM DQM histogram " << histogramName <<
" is not found.");
103 int n = histogram->GetXaxis()->GetNbins();
104 for (
int i = 1; i <= n; ++i) {
107 m_HitMap->setChannelData(channelNumber, histogram->GetBinContent(i));
Calibration collector module base class.
In the store you can park objects that have to be accessed by various modules.
@ c_IndexLevelSector
Sector.
StoreObjPtr< KLMChannelMapValue< unsigned int > > m_HitMap
Hit map.
~KLMChannelStatusCollectorModule()
Destructor.
StoreArray< KLMDigit > m_KLMDigits
KLM digits.
const KLMElementNumbers * m_ElementNumbers
Element numbers.
void collectFromDQM(const char *dqmFile)
Collection of data from DQM modules.
KLMChannelStatusCollectorModule()
Constructor.
void collect() override
This method is called for each event.
void closeRun() override
This method is called at the end of run.
void prepare() override
Initializer.
const KLMChannelArrayIndex * m_ChannelArrayIndex
KLM channel array index.
KLM digit (class representing a digitized hit in RPCs or scintillators).
uint16_t getNumber(uint16_t index) const
Get element number.
KLMChannelNumber channelNumber(int subdetector, int section, int sector, int layer, int plane, int strip) const
Get channel number.
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...
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
uint16_t KLMChannelNumber
Channel number.
Abstract base class for different kinds of events.