20 prim->Normalize(neutrino_scale, cosmic_scale);
26 std::cout <<
"Cut (" << prim->name <<
") value: " << prim->BestCut() << std::endl;
31 for (
unsigned i = 0; i <
event.reco.size(); i++) {
35 if (!is_signal && !is_bkg)
continue;
39 std::array<bool, ana::SBNOsc::Cuts::nCuts> results = cuts.
ProcessRecoCuts(event, i,
true);
49 if (file_is_neutrino) crt_track_angle.FillNeverNeutrino(is_signal);
50 else crt_track_angle.FillNeverCosmic(is_signal);
57 if (file_is_neutrino) crt_hit_distance.FillNeverNeutrino(is_signal);
58 else crt_hit_distance.FillNeverCosmic(is_signal);
66 fNeutrino.Initialize(this_name +
"neutrino_", cut_low, cut_high, n_bin);
67 fCosmic.Initialize(this_name +
"cosmic_", cut_low, cut_high, n_bin);
72 signal =
new TH1D((this_name +
"signal").c_str(), this_name.c_str(), n_bin, cut_low, cut_high);
73 background =
new TH1D((this_name +
"background").c_str(), this_name.c_str(), n_bin, cut_low, cut_high);
80 TH1D *hist = is_signal ? signal : background;
82 while (bin <= hist->GetNbinsX() && value > hist->GetXaxis()->GetBinCenter(bin)) {
83 hist->Fill(hist->GetXaxis()->GetBinCenter(bin));
86 n_signal += is_signal;
87 n_background += !is_signal;
91 TH1D *hist = is_signal ? signal : background;
93 for (
unsigned bin = 1; bin <= hist->GetNbinsX(); bin++) {
94 hist->Fill(hist->GetXaxis()->GetBinCenter(bin));
96 n_signal += is_signal;
97 n_background += !is_signal;
101 n_signal += is_signal;
102 n_background += !is_signal;
106 signal->Scale(scale);
107 background->Scale(scale);
109 n_background *= scale;
113 fNeutrino.Scale(scale_neutrino);
118 return fNeutrino.signal->GetBinContent(bin) +
fCosmic.signal->GetBinContent(bin);
122 return fNeutrino.background->GetBinContent(bin) +
fCosmic.background->GetBinContent(bin);
126 return fNeutrino.signal->GetNbinsX();
130 return fNeutrino.signal->GetBinCenter(bin);
134 return fNeutrino.n_signal +
fCosmic.n_signal;
138 return fNeutrino.n_background +
fCosmic.n_background;
142 float max_significance = 0.;
144 for (
unsigned bin = 1;
bin <= NCutVals();
bin++) {
145 float sig = Signal(
bin);
146 float bkg = Background(
bin);
147 float this_significance = 0.;
148 if (sig + bkg > 1.
e-4) {
149 this_significance = sig / sqrt(sig + bkg);
151 if (this_significance > max_significance) {
152 max_significance = this_significance;
153 best_cut = GetCutVal(
bin);
160 std::vector<float> eff;
161 std::vector<float> rejection;
162 for (
unsigned bin = 1;
bin <= NCutVals();
bin++) {
163 float this_eff = Signal(
bin) / NSignal();
164 float this_rej = 1 - Background(
bin) / NBackground();
165 eff.push_back(this_eff);
166 rejection.push_back(this_rej);
168 TGraph *
ROC =
new TGraph(NCutVals(), &eff[0], &rejection[0]);
169 ROC->SetTitle(
name.c_str());
170 ROC->SetName(
name.c_str());
bool TimeInSpill(float time) const
InteractionMode mode
Mode of the interaction.
Track track
CRT Track match.
NormalizedPrimitive crt_hit_distance
void Initialize(const std::string &name, float cut_low, float cut_high, unsigned n_bin)
float distance
//!< Distance from projected track to CRT Hit. Nonsense if present is false.
CRTMatch crt_match
CRTMatch.
bool present
Whether this CRTMatch has a matching track.
void Fill(bool is_signal, float value)
TruthMatch match
Info for mathing to truth.
void FillNever(bool is_signal)
float Signal(unsigned bin) const
int primary_track_index
Index of the primary track.
std::array< bool, nCuts > ProcessRecoCuts(const numu::RecoEvent &event, unsigned reco_vertex_index, bool fSequentialCuts=true) const
process_name use argoneut_mc_hitfinder track
float NBackground() const
float Background(unsigned bin) const
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
process_name standard_reco_uboone reco
void Fill(const Cuts &cuts, const numu::RecoEvent &event, bool file_is_neutrino)
bool present
Whether this CRTMatch has a matching hit.
void Normalize(float neutrino_scale, float cosmic_scale)
float GetCutVal(unsigned bin) const
void Normalize(float scale_neutrino, float scale_cosmic)
RecoSlice slice
Particle content of the interaction.
float angle
Angle between TPC track and CRT track.
unsigned NCutVals() const
void FillAlways(bool is_signal)
NormalizedPrimitive crt_track_angle
void Initialize(const std::string &name, float cut_low, float cut_high, unsigned n_bin)
std::vector< NormalizedPrimitive * > fAllPrimitives
HitMatch hit_match
CRT Hit match.
BEGIN_PROLOG could also be cout