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!";
83 TProfile*
histo =
dynamic_cast<TProfile*
>(
histo_.first);
92 uint16_t
nbins =
static_cast<uint16_t
>(
histo->GetNbinsX());
93 std::vector<float> bin_contents;
94 std::vector<float> bin_errors;
95 std::vector<float> bin_entries;
96 bin_contents.reserve(
nbins);
97 bin_errors.reserve(
nbins);
98 bin_entries.reserve(
nbins);
99 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
100 bin_contents.push_back(
histo->GetBinContent(ibin + 1));
101 bin_errors.push_back(
histo->GetBinError(ibin + 1));
102 bin_entries.push_back(
histo->GetBinEntries(ibin + 1));
103 if (bin_entries[ibin]) {
104 if (bin_contents[ibin] >
max) {
105 max = bin_contents[ibin];
107 if (bin_contents[ibin] <
min) {
108 min = bin_contents[ibin];
112 if (bin_contents.size() < 100) {
128 std::vector<float> tick;
129 std::vector<float>
base;
130 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
131 if (bin_entries[ibin]) {
133 base.push_back(bin_contents[ibin]);
135 tick.push_back(bin_contents[ibin]);
143 sort(tick.begin(), tick.end());
146 tickmark = tick[tick.size() % 2 ? tick.size() / 2 : tick.size() / 2];
151 anal->base_ = baseline;
152 anal->peak_ = tickmark;
153 anal->height_ = tickmark - baseline;
162 for (uint16_t ibin = 0; ibin <
base.size(); ibin++) {
168 mean2 = mean2 /
base.size();
176 std::map<uint16_t, float>
edges;
177 for (uint16_t ibin = 1; ibin <
nbins - 1; ibin++) {
178 if (bin_entries[ibin + 1] && bin_entries[ibin - 1]) {
179 float derivative = bin_contents[ibin + 1] - bin_contents[ibin - 1];
195 std::map<uint16_t, float>::iterator iter =
edges.begin();
199 for (uint16_t
ii = 0;
ii < 50;
ii++) {
200 uint16_t
bin = iter->first +
ii;
204 if (static_cast<uint32_t>(
bin) < 1 ||
static_cast<uint32_t
>(
bin + 1) >=
nbins) {
209 temp = bin_contents[
bin + 1] - bin_contents[
bin - 1];
212 if (
temp > max_derivative) {
213 max_derivative =
temp;
214 max_derivative_bin =
bin;
218 if (
ii > 10 &&
ii < 40 && bin_entries[
bin] && bin_contents[
bin] < baseline + 5. * baseline_rms) {
246 std::map<uint16_t, float> edges_r;
247 for (uint16_t ibin_r = 1; ibin_r <
nbins - 1; ibin_r++) {
248 if (bin_entries[ibin_r + 4] && bin_entries[ibin_r + 3] && bin_entries[ibin_r + 2] && bin_entries[ibin_r + 1] &&
249 bin_entries[ibin_r] && bin_entries[ibin_r - 1]) {
250 float derivative_r = bin_contents[ibin_r + 1] - bin_contents[ibin_r - 1];
251 float derivative_r1 = bin_contents[ibin_r + 1] - bin_contents[ibin_r];
252 float derivative_r2 = bin_contents[ibin_r + 2] - bin_contents[ibin_r + 1];
253 float derivative_r3 = bin_contents[ibin_r + 3] - bin_contents[ibin_r + 2];
255 if (derivative_r > 3. * baseline_rms && derivative_r1 > 1. * baseline_rms &&
256 derivative_r2 > 1. * baseline_rms && derivative_r3 > 1. * baseline_rms) {
257 edges_r[ibin_r] = derivative_r;
261 if (edges_r.empty()) {
269 bool found_r =
false;
270 std::map<uint16_t, float>::iterator iter_r = edges_r.begin();
271 while (!found_r && iter_r != edges_r.end()) {
274 int lowpointcount_r = 0;
275 const int lowpointallow_r = 25;
276 for (uint16_t ii_r = 0; ii_r < 50; ii_r++) {
277 uint16_t bin_r = iter_r->first + ii_r;
281 if (static_cast<uint32_t>(bin_r) < 1 ||
static_cast<uint32_t
>(bin_r + 1) >=
nbins) {
286 temp_r = bin_contents[bin_r + 1] - bin_contents[bin_r - 1];
289 if (temp_r > max_derivative_r && ii_r < 10) {
290 max_derivative_r = temp_r;
291 max_derivative = temp_r;
292 max_derivative_bin = bin_r;
296 if (ii_r > 10 && ii_r < 40 && bin_entries[bin_r] && bin_contents[bin_r] < baseline + 5. * baseline_rms) {
298 if (lowpointcount_r > lowpointallow_r) {
323 anal->time_ = max_derivative_bin * 25. / 24.;
CommissioningAnalysis *const anal() const
void extract(const std::vector< TH1 *> &) override
static const char unexpectedTask_[]
Derivative< X, A >::type derivative(const A &_)
Utility class that holds histogram title.
static const char numberOfHistos_[]
static const float tickMarkHeightThreshold_
static const uint16_t valid_
static const char incompletePlateau_[]
static const char numberOfBins_[]
uint32_t extractFedKey(const TH1 *const)
static const char missingTickMark_[]
static const char rejectedCandidate_[]
static const char mlCommissioning_[]
static const char tickMarkRecovered_[]
static const char tickMarkBelowThresh_[]
const Histo & histo() const
virtual void addErrorCode(const std::string &error)
const uint32_t & fedKey() const
static const char smallTickMarkHeight_[]
static const uint16_t invalid_
static const char noRisingEdges_[]
static const char smallDataRange_[]
Abstract base for derived classes that provide analysis of commissioning histograms.
Log< level::Warning, false > LogWarning
Analysis for timing run using APV tick marks.
static const char nullPtr_[]