muonid_rhc_dist.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Binning.h"
3 #include "CAFAna/Core/Spectrum.h"
5 
7 
12 
13 #include "TFile.h"
14 
15 #include <string>
16 #include <vector>
17 
19 #include "CAFAna/Vars/XsecTunes.h"
20 
21 using namespace ana;
22 using namespace ana::xsec::numubarcc;
23 
27 
28 void muonid_rhc_dist(string outfile = "muonid_rhc_dist_spec.root")
29 {
30  SpectrumHandler * handler = new SpectrumHandler();
31  handler->SetLoaders({ana::xsec::numubarcc::nominal_dataset.c_str()}, {"cv"});
33 
34  vector<Cut> cuts
35  {
38  preselectCut && trueSignalCut,
39  preselectCut && !trueSignalCut,
40  preselectCut && kIsNueorbarCC,
41  preselectCut && kIsNC,
42  preselectCut && kIsNumuCC,
43  preselectCut && !(kIsNumubarCC || kIsNueorbarCC || kIsNC || kIsNumuCC),
44  preselectCut && kIsNumubarCC && !kTrueVtxLooseCut
45  };
46 
47  vector<string> cut_labels
48  {
49  "signal_numubarcc",
50  "select",
51  "selsig",
52  "bkgd",
53  "nueorbar",
54  "nc",
55  "numucc",
56  "otherbkgd",
57  "selectedVtxFailure"
58  };
59 
60  vector<Var> weights
61  {
63  flux_wgt,
64  std_wgt
65  };
66 
67  vector<string> weight_labels
68  {
69  "unweighted",
70  "ppfx",
71  "xsecppfx"
72  };
73 
74  handler->SetVars({muonid_classifier::kMuonID}, {"muonid"}, {"MuonID"}, {ana::Binning::Simple(200, -1.0, 1.0)});
75  handler->SetCuts(cuts, cut_labels);
76  handler->SetWeights(weights, weight_labels);
77  handler->SetShifts(kNoShift);
78 
79  handler->CreateSpectrums();
80  handler->Go();
81 
82  TFile * fout = TFile::Open(outfile.c_str(), "RECREATE");
83  handler->SaveSpectrums(fout);
84  fout->Close();
85 }
Cut trueSignalCut
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
bool SaveSpectrums(TFile *f)
bool SetVars(const std::vector< Var > v, const std::vector< std::string > vl, const std::vector< std::string > vt, const std::vector< Binning > vb)
bool SetShifts(const std::vector< SystShifts > s, const std::vector< std::string > sl)
bool SetSpillCuts(const std::vector< SpillCut > spillcuts)
std::vector< std::string > cut_labels
Cut preselectCut
const Cut kQualityCut([](const caf::SRProxy *sr){return(sr->trk.kalman.ntracks > 0 &&sr->slc.nhit > 20 &&sr->slc.ncontplanes > 4);})
Preselection.
const Cut kContainmentCut([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;int ibesttrk=kBestMuonIDIndex(sr);if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return false;for(const caf::SRFuzzyKProngProxy &prong:sr->vtx.elastic.fuzzyk.png) if(!VtxInBounds(&prong.shwlid.start, containLow, containHigh)||!VtxInBounds(&prong.shwlid.stop, containLow, containHigh)) return false;if(sr->trk.kalman.ntracks< 1) return false;const unsigned short muon_catcher_edge=1275;for(unsigned int i=0;i< sr->trk.kalman.ntracks;++i){if(int(i)==ibesttrk) continue;if(sr->trk.kalman.tracks[i].start.Z() > muon_catcher_edge|| sr->trk.kalman.tracks[i].stop.Z() > muon_catcher_edge) return false;}const caf::SRKalmanTrackProxy &besttrack=sr->trk.kalman.tracks[ibesttrk];return((besttrack.stop.Z()< muon_catcher_edge||besttrack.trkyposattrans< 55) &&besttrack.trkfwdcellnd > 5 &&besttrack.trkbakcellnd > 10);})
Var weights
Cut outOfFiducialCut
const std::string nominal_dataset
const SystShifts kNoShift
Definition: SystShifts.cxx:22
bool SetLoaders(const std::vector< std::string > &ds, const std::vector< std::string > &dsnames)
const ana::Var std_wgt
void muonid_rhc_dist(string outfile="muonid_rhc_dist_spec.root")
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
const ana::Var flux_wgt
const Var kMuonID(muonid_classifier::MuonID)
bool SetCuts(const std::vector< Cut > c, const std::vector< std::string > cl)
const Cut kRecoVtxLooseCut([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;return VtxInBounds(&sr->vtx.elastic.vtx, loose_vtx_min, loose_vtx_max);})
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Var kUnweighted
Definition: Var.h:14
bool SetWeights(const std::vector< Var > w, const std::vector< std::string > wl)
FILE * outfile
Definition: dump_event.C:13