13#include "InitUtils.hpp"
20#include <TParameter.h>
27 InitUtils::SetROOTPreferences(PlotSaveFormat::kPNG,
30 gROOT->SetBatch(kTRUE);
32 const Bool_t all_tagged =
38 if (all_tagged && !scatter.
Prepare()) {
39 std::cerr <<
"compute-regions: could not build the scatter cache"
48 TFile f(cache,
"READ");
50 std::cerr <<
"compute-regions: no scatter cache at " << cache
51 <<
"; run strip-sum-scatter first" << std::endl;
54 if (TNamed *fp =
static_cast<TNamed *
>(f.Get(
"fingerprint"))) {
55 std::cout <<
"compute-regions: cache " << cache << std::endl;
56 std::cout <<
" fingerprint " << fp->GetTitle() << std::endl;
60 std::cout <<
"compute-regions: every tagged event is (a,n), no fit; reac "
64 std::cout <<
"compute-regions: bivariate Gaussian mixture per strip; "
70 Int_t nOk = 0, nTried = 0;
73 TH2F *h =
static_cast<TH2F *
>(f.Get(Form(
"scatter_r%d", reac)));
81 TCutG *an =
new TCutG(
"region_an", 5);
87 const Double_t nAn = h->Integral();
88 std::cout << Form(
" [region] reac %2d: all tagged events are (a,n): "
100 std::map<Int_t, std::pair<Double_t, Double_t>>::const_iterator it =
103 y_lo = it->second.first;
104 y_hi = it->second.second;
109 std::cout <<
" [region] reac " << reac <<
": no region -- " << fit.
why
123 << Form(
" [region] reac %2d: beam (%.3f, %.3f) s(%.3f, %.3f) "
124 "rho %+.2f | (a,n) (%.3f, %.3f) s(%.3f, %.3f) rho %+.2f "
125 "| attributed %.0f, in region %.0f; (a,a') in region %.0f",
139 std::cout <<
"compute-regions: regions for " << nOk <<
" of " << nTried
140 <<
" reaction strips" << std::endl;
142 std::cout <<
"compute-regions: tagged traces per reaction strip against "
149 TFile fc(cache,
"READ");
150 Double_t mean[18], sigma[18];
152 for (Int_t s = 0; s < 18 && have; s++) {
153 TParameter<Double_t> *pm =
static_cast<TParameter<Double_t> *
>(
154 fc.Get(Form(
"strip_mean_s%d", s)));
155 TParameter<Double_t> *ps =
static_cast<TParameter<Double_t> *
>(
156 fc.Get(Form(
"strip_sigma_s%d", s)));
158 mean[s] = pm ? pm->GetVal() : 1.0;
159 sigma[s] = ps ? ps->GetVal() : 0.0;
168 return nOk > 0 ? 0 : 1;
The reaction search: strip-sum scatters, beam gating and tagging.
static TString ResultsDir()
Absolute path to the directory receiving generated output.
Builds the strip-sum scatters, tags reactions, and draws the results.
static TString CacheName()
Filename of the scatter cache for this configuration.
static void SetStripNoise(const Double_t *mean, const Double_t *sigma)
Install the per-strip beam means and sigmas.
void DrawAllTaggedTraces(const TString &subdir)
Region-trace overlays of every tagged event, one figure per reaction strip, against the beam band.
Bool_t Prepare()
Measure the beam, then load the scatter cache or build it.
void SimTagReport()
Run the data selection over every simulated population: the event-level cuts (all but the beam gate,...
int main()
compute-regions: fit each reaction strip's (a,n) and (a,a') regions from the scatter cache and save t...
void ActivateAnalysisEpoch()
Make AnalysisEpoch() the active epoch, so a binary of the cross-section chain resolves the file tag,...
const DatasetConfig & cfg
The active dataset's configuration, flat block.
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.
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.
Double_t CountInside(TH2F *scatter, TCutG *cut, const RegionFit &fit)
Count scatter events inside a cut.
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.
const Double_t kXMin
Lower x bound of the build window.
const Double_t kXMax
Upper x bound; x sums 16 strips.
const Double_t kYMin
Lower y bound.
const Double_t kYMax
Upper y bound; y sums the post-trigger strips only.
Double_t rho
x-y correlation, in [-1, 1].
Result of fitting the two-component mixture to one strip's scatter.
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.
AnRegionMode
How compute-regions defines the (a,n) region.
Double_t X_DISPLAY_MIN
Display-only windows for the strip-sum scatters (a.u.): the histograms are built over the fixed Scatt...
AnRegionMode AN_REGION_MODE
Double_t AN_REGION_NSIGMA
compute-regions: the (a,n) region is the reaction component's AN_REGION_NSIGMA Mahalanobis ellipse fr...
Double_t AA_REGION_NSIGMA
std::map< Int_t, std::pair< Double_t, Double_t > > Y_DISPLAY_RANGE
Per-reaction-strip y-axis display windows, overriding Y_DISPLAY_MIN/MAX for individual strips (displa...