26 <<
" NULL pointer to Analysis object!";
41 std::vector<TH1*>::const_iterator ihis =
histos.begin();
42 for (; ihis !=
histos.end(); ihis++) {
57 histo_.second = (*ihis)->GetName();
66 <<
" NULL pointer to base Analysis object!";
74 <<
" NULL pointer to derived Analysis object!";
86 uint16_t
nbins =
static_cast<uint16_t
>(
histo_.first->GetNbinsX());
87 std::vector<float> bin_contents;
88 std::vector<float> bin_errors;
89 std::vector<float> bin_entries;
90 bin_contents.reserve(
nbins);
91 bin_errors.reserve(
nbins);
92 bin_entries.reserve(
nbins);
93 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
94 bin_contents.push_back(
histo_.first->GetBinContent(ibin + 1));
95 bin_errors.push_back(
histo_.first->GetBinError(ibin + 1));
97 if (bin_entries[ibin]) {
98 if (bin_contents[ibin] >
max) {
99 max = bin_contents[ibin];
101 if (bin_contents[ibin] <
min) {
102 min = bin_contents[ibin];
107 if (bin_contents.size() < 100) {
123 std::vector<float> tick;
124 std::vector<float>
base;
125 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
126 if (bin_entries[ibin]) {
128 base.push_back(bin_contents[ibin]);
130 tick.push_back(bin_contents[ibin]);
140 sort(tick.begin(), tick.end());
143 tickmark = tick[tick.size() % 2 ? tick.size() / 2 : tick.size() / 2];
150 if ((tickmark - baseline) < 50.) {
158 for (uint16_t ibin = 0; ibin <
base.size(); ibin++) {
164 mean2 = mean2 /
base.size();
169 float baseline_rms = 0.;
178 std::map<uint16_t, float>
edges;
179 for (uint16_t ibin = 1; ibin <
nbins - 1; ibin++) {
180 if (bin_entries[ibin + 1] && bin_entries[ibin - 1]) {
181 float derivative = bin_contents[ibin + 1] - bin_contents[ibin - 1];
194 std::map<uint16_t, float>::iterator iter =
edges.begin();
198 for (uint16_t
ii = 0;
ii < 50;
ii++) {
199 uint16_t
bin = iter->first +
ii;
202 float temp_deriv = 0;
203 if (static_cast<uint32_t>(
bin) < 1 ||
static_cast<uint32_t
>(
bin + 1) >=
nbins) {
206 temp_deriv = bin_contents[
bin + 1] - bin_contents[
bin - 1];
209 if (temp_deriv > max_deriv) {
210 max_deriv = temp_deriv;
215 if (
ii > 10 &&
ii < 40 && bin_entries[
bin] && bin_contents[
bin] < baseline + 5 * baseline_rms) {
233 if (!
edges.empty()) {
234 anal->time_ = deriv_bin;
236 anal->base_ = baseline;
237 anal->peak_ = tickmark;
238 anal->height_ = tickmark - baseline;
241 anal->base_ = baseline;
242 anal->peak_ = tickmark;
243 anal->height_ = tickmark - baseline;
CommissioningAnalysis *const anal() const
static const char unexpectedTask_[]
Derivative< X, A >::type derivative(const A &_)
Utility class that holds histogram title.
static const char numberOfHistos_[]
static const char numberOfBins_[]
uint32_t extractFedKey(const TH1 *const)
static const char missingTickMark_[]
static const char mlCommissioning_[]
virtual void addErrorCode(const std::string &error)
Analysis for timing run using APV tick marks.
const uint32_t & fedKey() const
void extract(const std::vector< TH1 *> &) override
static const uint16_t invalid_
static const char smallDataRange_[]
Abstract base for derived classes that provide analysis of commissioning histograms.
Log< level::Warning, false > LogWarning
static const char nullPtr_[]