All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CutOptimizer.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #include <string>
9 
10 namespace ana
11 {
12  /// \brief Make a series of spectra leaving out one cut in turn
13  ///
14  /// This function does *not* call Go() on the loader, allowing you to combine
15  /// it with other spectra-filling if desired.
16  ///
17  /// \param loader SpectrumLoader to associate spectra with
18  /// \param sigcut Definition of signal (inverse defines background)
19  /// \param presel Cuts that will always be applied
20  /// \param axes Variables that will be cut on
21  /// \param cut_pos Cut position for each variable
22  /// \param[out] sigs Resulting signal spectra
23  /// \param[out] bkgs Resulting background spectra
24  void MakeNMinusOneSpectra(SpectrumLoader& loader,
25  const Cut& sigcut,
26  const Cut& presel,
27  const std::vector<HistAxis>& axes,
28  const std::vector<double>& cut_pos,
29  std::vector<Spectrum>& sigs,
30  std::vector<Spectrum>& bkgs);
31 
32  /// \brief Search for optimum cut position given signal and background histograms
33  ///
34  /// \param hsig Signal distribution
35  /// \param hbkg Background distribution
36  /// \param[out] best_fom Figure of Merit obtained by best cut
37  /// \returns Best cut position
38  double FindOptimumCut(TH1* hsig, TH1* hbkg, double& best_fom);
39 
40  /// \brief Scan all cuts and update the one giving the largest FOM gain
41  ///
42  /// \param wildcard File name / wildcard / dataset name
43  /// \param pot POT to scale to
44  /// \param sigcut Definition of signal (inverse defines background)
45  /// \param presel Cuts that will always be applied
46  /// \param axes Variables that will be cut on
47  /// \param[out] cut_pos Starting cut position for each variable. One of these values will be updated
48  /// \returns FOM achieved by optimized cuts
49  double OptimizeOneCut(const std::string& wildcard,
50  double pot,
51  const Cut& sigcut,
52  const Cut& presel,
53  const std::vector<HistAxis>& axes,
54  std::vector<double>& cut_pos);
55 
56  /// \brief Repeatedly invoke \ref OptimizeOneCut until the FOM increase becomes small
57  void OptimizeCuts(const std::string& wildcard,
58  double pot,
59  const Cut& sigcut,
60  const Cut& presel,
61  const std::vector<HistAxis>& axes,
62  std::vector<double>& cut_pos);
63 }
void OptimizeCuts(const std::string &wildcard, double pot, const Cut &sigcut, const Cut &presel, const std::vector< HistAxis > &axes, std::vector< double > &cut_pos)
Repeatedly invoke OptimizeOneCut until the FOM increase becomes small.
tuple loader
Definition: demo.py:7
void MakeNMinusOneSpectra(SpectrumLoader &loader, const Cut &sigcut, const Cut &presel, const std::vector< HistAxis > &axes, const std::vector< double > &cut_pos, std::vector< Spectrum > &sigs, std::vector< Spectrum > &bkgs)
Make a series of spectra leaving out one cut in turn.
process_name opflashCryoW ana
double FindOptimumCut(TH1 *hsig, TH1 *hbkg, double &best_fom)
Search for optimum cut position given signal and background histograms.
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
double OptimizeOneCut(const std::string &wildcard, double pot, const Cut &sigcut, const Cut &presel, const std::vector< HistAxis > &axes, std::vector< double > &cut_pos)
Scan all cuts and update the one giving the largest FOM gain.