12 #include "CAFAna/Cuts/NumuCuts.h" 13 #include "CAFAna/Core/Binning.h" 17 #include "CAFAna/Systs/NumuSysts.h" 34 #include "TMultiGraph.h" 39 #include "TPaveText.h" 62 fCans.push_back(
new TCanvas(name.c_str(), title.c_str()));
68 return NewCan(nameTitle, nameTitle);
73 for(
const auto&
can:fCans)
76 can->SaveAs(name.c_str());
87 if (opt.find(
"same") == std::string::npos &&
88 opt.find(
"SAME") == std::string::npos)
100 fShortName(shortName),
118 fSpec(loader, axis, cut),
120 fShortName(shortName),
129 TH1*
h = fSpec.Oscillated(calc, from, to).ToTH1(pot);
130 h->SetLineColor(fColor);
131 h->SetLineStyle(style);
132 h->Draw(opt.c_str());
133 leg->AddEntry(h, fLongName.c_str(),
"l");
141 TH1*
h = fSpec.Oscillated(calc, from, to).ToTH1(pot);
142 h->GetYaxis()->SetTitle(
"Efficiency");
143 h->Divide(denominator);
144 h->SetLineColor(fColor);
145 h->SetLineStyle(fStyle);
146 h->Draw(opt.c_str());
147 leg->AddEntry(h, fLongName.c_str(),
"l");
152 return fSpec.Oscillated(calc, from, to).ToTH1(pot);
170 std::vector<Sample> samples):
176 fSamples.reserve(samples.size());
177 for(
const auto& sample:samples)
179 fSamples.emplace_back(sample.fShortName, sample.fLongName,
181 fLoader, fAxis, kBlack);
183 fLevels.resize(fSamples.size());
188 for(
size_t iSample = 0; iSample < fSamples.size(); ++iSample)
190 fLevels[iSample].emplace_back(shortName, longName,
191 fSamples[iSample].fCut && cut,
192 fLoader, fAxis, color);
201 for(
auto& samp:fLevels)
209 for(
size_t iSample = 0; iSample < fSamples.size(); ++iSample){
210 if(!sampleName.compare(fSamples[iSample].fShortName))
222 int i = findSample(sample);
226 TLegend*
leg =
new TLegend(0.55, 0.55, 0.85, 0.85);
227 fSamples[
i].Draw(pot, currOpt, calc, from, to, leg, style);
229 for(
size_t iLevel = 0; iLevel < fLevels[
i].size(); ++iLevel){
230 fLevels[
i][iLevel].Draw(pot, currOpt, calc, from, to, leg, style);
241 int i = findSample(sample);
246 TH1* denominator = fSamples[
i].ToTH1(pot, calc, from, to);
248 for(
size_t iLevel = 0; iLevel < fLevels[
i].size(); ++iLevel){
249 fLevels[
i][iLevel].DrawEfficiency(pot, currOpt,
250 calc, from, to, denominator, leg);
275 Cut truthContain({
"sel.contain.missE",
"mc.nu.E",
"mc.nnu"},
278 if(
sr->
mc.
nnu == 0)
return false;
282 Cut cvn({
"sel.cvnnumu.output",
"sel.cvnnumu.noutput"},
285 if(!
sr->
sel.cvnnumu.noutput)
return false;
286 return sr->
sel.cvnnumu.output[0] > 0.35;
289 Cut cvn2({
"sel.cvnnumu.output",
"sel.cvnnumu.noutput"},
292 if(!
sr->
sel.cvnnumu.noutput)
return false;
293 return sr->
sel.cvnnumu.output[0] > 0.5;
297 Var cvnOut({
"sel.cvnnumu.output",
"sel.cvnnumu.noutput"},
300 if(!
sr->
sel.cvnnumu.noutput)
return -5.f;
301 return sr->
sel.cvnnumu.output[0];
307 "/cloud/login/rocco/development/results/2015-10-20_caf_nonswap_numu/fardet_genie_fhc_nonswap_ideal_3000_r01000001_s*");
311 {Sample(
"sig",
"Truth Containment",
313 Sample(
"bkg",
"Truth Containment",
322 remid.AddLevel(
"containment",
"Containment",
324 remid.AddLevel(
"NCRej",
"CVN Loose",
328 remid.AddLevel(
"NCRej",
"CVN Tight",
331 remid.AddLevel(
"NCRej",
"ReMId",
347 remid.Draw(3e20,
"sig",
"H", calc, 14, 14);
350 remid.DrawEfficiency(3e20,
"sig",
"H", calc, 14, 14);
353 remid.Draw(3e20,
"bkg",
"H", calc, 14, 14);
356 remid.DrawEfficiency(3e20,
"bkg",
"H", calc, 14, 14);
358 canMan.
NewCan(
"cvn_dist");
361 hSig->SetLineColor(
kRed);
362 hBkg->SetLineColor(
kBlue);
364 hBkg->Draw(
"HIST SAME");
367 leg->AddEntry(hSig,
"Contained #nu_{#mu} Signal",
"l");
368 leg->AddEntry(hBkg,
"Contained Background",
"l");
377 remid.Draw(3e20,
"sig",
"H", calcOsc, 14, 14);
379 canMan.
NewCan(
"sig_eff_osc");
380 remid.DrawEfficiency(3e20,
"sig",
"H", calcOsc, 14, 14);
383 remid.Draw(3e20,
"bkg",
"H", calcOsc, 14, 14);
385 canMan.
NewCan(
"bkg_eff_osc");
386 remid.DrawEfficiency(3e20,
"bkg",
"H", calcOsc, 14, 14);
388 canMan.
NewCan(
"cvn_dist_osc");
391 hSigOsc->SetLineColor(
kRed);
392 hBkgOsc->SetLineColor(
kBlue);
393 hBkgOsc->Draw(
"HIST");
394 hSigOsc->Draw(
"HIST SAME ");
397 legOsc->AddEntry(hSigOsc,
"Contained #nu_{#mu} Signal",
"l");
398 legOsc->AddEntry(hBkgOsc,
"Contained Background",
"l");
401 canMan.
SaveCans(
"cvn_plots/",
".pdf");
void DrawEfficiency(float pot, std::string opt, osc::IOscCalc *calc, int from, int to, TH1 *denominator, TLegend *leg)
std::vector< TCanvas * > fCans
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
TH1 * ToTH1(float pot, osc::IOscCalc *calc, int from, int to)
Cuts and Vars for the 2020 FD DiF Study.
float missE
sum of energy of particles that leave detector. example cut: missE/trueE > 0.01 is truly uncontained ...
Sample(std::string shortName, std::string longName, Cut cut)
std::vector< std::vector< CutLevel > > fLevels
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
OscillatableSpectrum fSpec
TCanvas * SaveCans(std::string prefix="", std::string suffix=".pdf")
General interface to oscillation calculators.
const Cut kNumuContainFD([](const caf::SRProxy *sr){ std::pair< int, int > planes=calcFirstLastLivePlane(sr->slc.firstplane, std::bitset< 14 >(sr->hdr.dibmask));int planestofront=sr->slc.firstplane-planes.first;int planestoback=planes.second-sr->slc.lastplane;return( sr->slc.ncellsfromedge > 1 &&planestofront > 1 &&planestoback > 1 &&sr->sel.contain.kalfwdcell > 10 &&sr->sel.contain.kalbakcell > 10 &&sr->sel.contain.cosfwdcell > 0 &&sr->sel.contain.cosbakcell > 0);})
void SetSpillCut(const SpillCut &cut)
Defines an enumeration for prong classification.
int findSample(std::string sampleName)
_NoOscillations< double > NoOscillations
void AddLevel(std::string shortName, std::string longName, Cut cut, int color)
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
TCanvas * NewCan(std::string name, std::string title)
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it's s...
virtual void Go() override
Load all the registered spectra.
std::vector< CutLevel > fSamples
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
const Cut kNumuNCRej([](const caf::SRProxy *sr){return(sr->sel.remid.pid >0.75);})
short nnu
Number of neutrinos in nu vector (0 or 1)
The StandardRecord is the primary top-level object in the Common Analysis File trees.
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
SRIDBranch sel
Selector (PID) branch.
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
SRTruthBranch mc
Truth branch for MC: energy, flavor, etc.
void DrawEfficiency(float pot, std::string sample, std::string opt, osc::IOscCalc *calc, int from, int to)
TLegend * AutoPlaceLegend(double dx, double dy, double yPin)
Create a legend, maximizing distance from all histograms.
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
void addSame(std::string &opt)
CutLevel(std::string shortName, std::string longName, Cut cut, SpectrumLoader &loader, const HistAxis &axis, int color)
void Draw(float pot, std::string sample, std::string opt, osc::IOscCalc *calc, int from, int to, int style=1)
void Draw(float pot, std::string opt, osc::IOscCalc *calc, int from, int to, TLegend *leg, int style=1)
Spectrum with true energy information, allowing it to be oscillated
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
SRContain contain
Output from SRContain (containment related variables)
std::vector< SRNeutrino > nu
implemented as a vector to maintain mc.nu structure, i.e. not a pointer, but with 0 or 1 entries...
TCanvas * NewCan(std::string nameTitle)
CutFlow(std::string name, SpectrumLoader &loader, const HistAxis &axis, std::vector< Sample > samples)