MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches
RegionCuts.hpp
Go to the documentation of this file.
1#ifndef REGION_CUTS_HPP
2#define REGION_CUTS_HPP
3
4#include <TCutG.h>
5#include <TH2F.h>
6#include <TString.h>
7
20namespace RegionCutStore {
22TString Dir();
26TString Path(const char *name, Int_t reac);
37void Save(Int_t reac, TCutG *cut_an, TCutG *cut_aa,
38 Double_t n_an_assigned = -1.0);
49TCutG *Load(const char *name, Int_t reac);
61TCutG *LoadDrawn(const char *name, Int_t reac);
66Double_t LoadAssigned(const char *name, Int_t reac);
67} // namespace RegionCutStore
68
75struct Gauss2D {
76 Double_t amp = 0.0;
77 Double_t mx = 0.0;
78 Double_t sx = 0.0;
79 Double_t my = 0.0;
80 Double_t sy = 0.0;
81 Double_t rho = 0.0;
82};
83
90struct RegionFit {
93 Double_t x_lo = 0.0, x_hi = 0.0, y_lo = 0.0, y_hi = 0.0;
101 Double_t n_beam = 0.0, n_reac = 0.0;
105 Bool_t has_reac = kTRUE;
106 Bool_t ok = kFALSE;
107 TString why;
108};
109
110namespace RegionCutStore {
120void SaveFit(Int_t reac, const RegionFit &fit);
121
128Bool_t LoadFit(Int_t reac, RegionFit &fit);
129} // namespace RegionCutStore
130
155RegionFit FitMixture(TH2F *scatter, Int_t reac, Double_t x_lo, Double_t x_hi,
156 Double_t y_lo, Double_t y_hi);
157
166TCutG *EllipseCut(const char *name, const Gauss2D &g, Double_t nsigma,
167 Int_t npts = 64);
168
185RegionFit FitBeam(TH2F *scatter, Int_t reac, Double_t x_lo, Double_t x_hi,
186 Double_t y_lo, Double_t y_hi);
187
199Double_t AboveRidge(const Gauss2D &beam, Double_t x, Double_t y);
200
217TCutG *RidgeBandCut(const char *name, const Gauss2D &beam, Double_t nsig_lo,
218 Double_t nsig_hi, Double_t x_lo, Double_t x_hi,
219 Double_t y_lo, Double_t y_hi);
220
228Double_t CountInside(TH2F *scatter, TCutG *cut, const RegionFit &fit);
229
244void SaveFigures(TH2F *scatter, Int_t reac, const RegionFit &fit, TCutG *an,
245 TCutG *aa, const TString &subdir);
246} // namespace RegionCutFinder
247
248#endif
Finding regions by fitting a two-component mixture to the scatter.
RegionFit FitMixture(TH2F *scatter, Int_t reac, Double_t x_lo, Double_t x_hi, Double_t y_lo, Double_t y_hi)
Fit the two-component mixture to one strip's scatter.
TCutG * EllipseCut(const char *name, const Gauss2D &g, Double_t nsigma, Int_t npts=64)
Closed polygon of a component's Mahalanobis contour.
TCutG * RidgeBandCut(const char *name, const Gauss2D &beam, Double_t nsig_lo, Double_t nsig_hi, Double_t x_lo, Double_t x_hi, Double_t y_lo, Double_t y_hi)
Closed polygon of a band above the beam ridge.
Double_t AboveRidge(const Gauss2D &beam, Double_t x, Double_t y)
How far a point sits above the beam ridge, in conditional sigma.
void SaveFigures(TH2F *scatter, Int_t reac, const RegionFit &fit, TCutG *an, TCutG *aa, const TString &subdir)
Save the diagnostic figures for a strip's regions.
RegionFit FitBeam(TH2F *scatter, Int_t reac, Double_t x_lo, Double_t x_hi, Double_t y_lo, Double_t y_hi)
Fit the beam component alone, with no reaction component.
Double_t CountInside(TH2F *scatter, TCutG *cut, const RegionFit &fit)
Count scatter events inside a cut.
On-disk home of the per-strip (a,n) and (a,a') region cuts.
TCutG * LoadDrawn(const char *name, Int_t reac)
Load only a hand-drawn cut, never a fitted one.
TString Path(const char *name, Int_t reac)
Path to one cut's file.
void Save(Int_t reac, TCutG *cut_an, TCutG *cut_aa, Double_t n_an_assigned=-1.0)
Write a strip's two region cuts.
void SaveFit(Int_t reac, const RegionFit &fit)
Store the fitted components beside the (a,n) cut.
Bool_t LoadFit(Int_t reac, RegionFit &fit)
Read back a stored fit.
TString Dir()
Directory holding the region cut files.
TCutG * Load(const char *name, Int_t reac)
Load a cut, from either storage generation.
Double_t LoadAssigned(const char *name, Int_t reac)
The attributed count stored with a cut.
One bivariate Gaussian component of a strip's scatter.
Double_t mx
Mean in x.
Double_t sx
Width in x.
Double_t amp
Amplitude.
Double_t rho
x-y correlation, in [-1, 1].
Double_t sy
Width in y.
Double_t my
Mean in y.
Result of fitting the two-component mixture to one strip's scatter.
Double_t y_hi
Fit window.
Double_t n_beam
Events the mixture attributes to each component.
Double_t x_lo
Bool_t has_reac
kFALSE for a beam-only fit, as used by the ridge-band region mode.
Double_t n_reac
TString why
Why the fit failed; set only when ok is false.
Bool_t ok
Whether the fit succeeded. Check this first.
Gauss2D reac
The reaction population above the ridge.
Gauss2D beam
The beam-like population, pinned from its own core.
Double_t y_lo
Double_t x_hi