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!";
84 uint16_t non_zero = 0;
87 uint16_t
nbins = static_cast<uint16_t>(
histo_.first->GetNbinsX());
88 std::vector<float> bin_contents;
89 std::vector<float> bin_errors;
90 std::vector<float> bin_entries;
91 bin_contents.reserve(
nbins);
92 bin_errors.reserve(
nbins);
93 bin_entries.reserve(
nbins);
94 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
95 bin_contents.push_back(
histo_.first->GetBinContent(ibin + 1));
96 bin_errors.push_back(
histo_.first->GetBinError(ibin + 1));
98 if (bin_entries[ibin]) {
99 if (bin_contents[ibin] >
max) {
100 max = bin_contents[ibin];
102 if (bin_contents[ibin] <
min) {
103 min = bin_contents[ibin];
110 if (bin_contents.size() < 100) {
126 std::vector<float> tick;
127 std::vector<float>
base;
128 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
129 if (bin_entries[ibin]) {
131 base.push_back(bin_contents[ibin]);
133 tick.push_back(bin_contents[ibin]);
143 sort(tick.begin(), tick.end());
146 tickmark = tick[tick.size() % 2 ? tick.size() / 2 : tick.size() / 2];
153 if ((tickmark - baseline) < 50.) {
161 for (uint16_t ibin = 0; ibin <
base.size(); ibin++) {
167 mean2 = mean2 /
base.size();
172 float baseline_rms = 0.;
181 std::map<uint16_t, float>
edges;
182 for (uint16_t ibin = 1; ibin <
nbins - 1; ibin++) {
183 if (bin_entries[ibin + 1] && bin_entries[ibin - 1]) {
184 float derivative = bin_contents[ibin + 1] - bin_contents[ibin - 1];
197 std::map<uint16_t, float>::iterator iter =
edges.begin();
201 for (uint16_t
ii = 0;
ii < 50;
ii++) {
202 uint16_t
bin = iter->first +
ii;
205 float temp_deriv = 0;
206 if (static_cast<uint32_t>(
bin) < 1 || static_cast<uint32_t>(
bin + 1) >=
nbins) {
209 temp_deriv = bin_contents[
bin + 1] - bin_contents[
bin - 1];
212 if (temp_deriv > max_deriv) {
213 max_deriv = temp_deriv;
218 if (
ii > 10 &&
ii < 40 && bin_entries[
bin] && bin_contents[
bin] < baseline + 5 * baseline_rms) {
236 if (!
edges.empty()) {
237 anal->time_ = deriv_bin;
239 anal->base_ = baseline;
240 anal->peak_ = tickmark;
241 anal->height_ = tickmark - baseline;
244 anal->base_ = baseline;
245 anal->peak_ = tickmark;
246 anal->height_ = tickmark - baseline;