9#include "CorrFitMask1D.h"
12 Bool_t CorrFitMask1D::AreCompatible(TObject* cf)
const {
13 auto func =
dynamic_cast<Femto1DCF*
>(cf);
14 if (!func)
return kFALSE;
16 Double_t minim, maxim;
17 Std::GetAxisPar(*func->GetNum(), bins, minim, maxim,
"x");
18 if (fBins != bins)
return kFALSE;
19 if (fMin != minim)
return kFALSE;
20 if (fMax != maxim)
return kFALSE;
24 void CorrFitMask1D::Reset(Bool_t state) {
25 for (
auto& i : fRawMask) {
30 void CorrFitMask1D::ApplyThreshold(
const TH1& h, Double_t threshold) {
31 for (
int i = 1; i <= h.GetNbinsX(); i++) {
32 if (h.GetBinContent(i) <= threshold) { fRawMask[i] =
false; }
36 CorrFitMask1D::CorrFitMask1D(Int_t bins, Double_t min, Double_t max) : fBins(bins), fMin(min), fMax(max) {
37 fRawMask.resize(fBins + 2);
38 for (
auto& i : fRawMask) {
43 void CorrFitMask1D::ApplyRange(Double_t min, Double_t max, Bool_t additive) {
44 Double_t binW = 1.0 / ((fMax - fMin) / double(fBins));
45 int low = (min - fMin) * binW + 1;
46 int high = (max - fMin) * binW + 1;
48 if (high > fBins + 1) high = fBins + 1;
50 for (
int i = low; i <= high; i++) {
54 for (
int i = 0; i < low; i++) {
57 for (
int i = high + 1; i < (int) fRawMask.size(); i++) {
63 Bool_t CorrFitMask1D::Init() {
65 for (
unsigned int i = 1; i < fRawMask.size() - 1; i++) {
66 if (fRawMask[i]) fActiveBins++;
72 void CorrFitMask1D::SetBin(Int_t bin, Bool_t state) { fRawMask[bin] = state; }