Skip to content

Commit d58bd36

Browse files
authored
[ZDC] moved histogram creation in initialize method (#1968)
The modification does not the change the final behaviour of the code, but the histogram creation is moved to a more usual place Signed-off-by: aferrero2707 <aferrero1975@gmail.com>
1 parent 42f70f0 commit d58bd36

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

Modules/ZDC/include/ZDC/ZDCRecDataPostProcessing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class ZDCRecDataPostProcessing : public PostProcessingInterface
9494
std::map<size_t, MOHelper> mMOsTDC;
9595

9696
// Hit rate histograms ===============================================
97+
std::vector<std::string> mBinLabelsADC;
98+
std::vector<std::string> mBinLabelsTDC;
9799
std::unique_ptr<TH1F> mSummaryADCHisto;
98100
std::unique_ptr<TH1F> mSummaryTDCHisto;
99101
};

Modules/ZDC/src/ZDCRecDataPostProcessing.cxx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -130,54 +130,50 @@ void ZDCRecDataPostProcessing::configure(const boost::property_tree::ptree& conf
130130
PostProcessingConfigZDC zdcConfig(getID(), config);
131131

132132
// ADC summary plot
133-
std::vector<std::string> binLabelsADC;
134133
for (auto source : zdcConfig.dataSourcesADC) {
135134
std::string histName, moName;
136135
splitDataSourceName(source.name, histName, moName);
137136
if (moName.empty()) {
138137
continue;
139138
}
140139

141-
binLabelsADC.emplace_back(histName);
142-
mMOsADC.emplace(binLabelsADC.size(), MOHelper(source.path, moName));
140+
mBinLabelsADC.emplace_back(histName);
141+
mMOsADC.emplace(mBinLabelsADC.size(), MOHelper(source.path, moName));
143142
}
144143

145-
mSummaryADCHisto = std::make_unique<TH1F>("h_summary_ADC", "Summary ADC", binLabelsADC.size(), 0, binLabelsADC.size());
146-
for (size_t bin = 0; bin < binLabelsADC.size(); bin++) {
147-
mSummaryADCHisto->GetXaxis()->SetBinLabel(bin + 1, binLabelsADC[bin].c_str());
148-
}
149-
publishHisto(mSummaryADCHisto.get(), false, "E", "");
150-
151144
// TDC summary plot
152-
std::vector<std::string> binLabelsTDC;
153145
for (auto source : zdcConfig.dataSourcesTDC) {
154146
std::string histName, moName;
155147
splitDataSourceName(source.name, histName, moName);
156148
if (moName.empty()) {
157149
continue;
158150
}
159151

160-
binLabelsTDC.emplace_back(histName);
161-
mMOsTDC.emplace(binLabelsTDC.size(), MOHelper(source.path, moName));
152+
mBinLabelsTDC.emplace_back(histName);
153+
mMOsTDC.emplace(mBinLabelsTDC.size(), MOHelper(source.path, moName));
162154
}
163-
164-
mSummaryTDCHisto = std::make_unique<TH1F>("h_summary_TDC", "Summary TDC", binLabelsTDC.size(), 0, binLabelsTDC.size());
165-
for (size_t bin = 0; bin < binLabelsTDC.size(); bin++) {
166-
mSummaryTDCHisto->GetXaxis()->SetBinLabel(bin + 1, binLabelsTDC[bin].c_str());
167-
}
168-
publishHisto(mSummaryTDCHisto.get(), false, "E", "");
169155
}
170156

171157
//_________________________________________________________________________________________
172158

173159
void ZDCRecDataPostProcessing::createSummaryADCHistos(Trigger t, repository::DatabaseInterface* qcdb)
174160
{
161+
mSummaryADCHisto = std::make_unique<TH1F>("h_summary_ADC", "Summary ADC", mBinLabelsADC.size(), 0, mBinLabelsADC.size());
162+
for (size_t bin = 0; bin < mBinLabelsADC.size(); bin++) {
163+
mSummaryADCHisto->GetXaxis()->SetBinLabel(bin + 1, mBinLabelsADC[bin].c_str());
164+
}
165+
publishHisto(mSummaryADCHisto.get(), false, "E", "");
175166
}
176167

177168
//_________________________________________________________________________________________
178169

179170
void ZDCRecDataPostProcessing::createSummaryTDCHistos(Trigger t, repository::DatabaseInterface* qcdb)
180171
{
172+
mSummaryTDCHisto = std::make_unique<TH1F>("h_summary_TDC", "Summary TDC", mBinLabelsTDC.size(), 0, mBinLabelsTDC.size());
173+
for (size_t bin = 0; bin < mBinLabelsTDC.size(); bin++) {
174+
mSummaryTDCHisto->GetXaxis()->SetBinLabel(bin + 1, mBinLabelsTDC[bin].c_str());
175+
}
176+
publishHisto(mSummaryTDCHisto.get(), false, "E", "");
181177
}
182178

183179
//_________________________________________________________________________________________
@@ -187,7 +183,7 @@ void ZDCRecDataPostProcessing::initialize(Trigger t, framework::ServiceRegistryR
187183
auto& qcdb = services.get<repository::DatabaseInterface>();
188184

189185
createSummaryADCHistos(t, &qcdb);
190-
createSummaryADCHistos(t, &qcdb);
186+
createSummaryTDCHistos(t, &qcdb);
191187
}
192188

193189
//_________________________________________________________________________________________

0 commit comments

Comments
 (0)