nue_nd_datastability.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Spectrum.h"
4 
7 
8 #include "CAFAna/Vars/Vars.h"
12 #include "CAFAna/Vars/HistAxes.h"
13 
14 #include "TCanvas.h"
15 #include "TH2.h"
16 #include "TFile.h"
17 #include "TLegend.h"
18 #include "TPad.h"
19 #include "TLine.h"
20 
21 #include <vector>
22 #include <string>
23 
24 using namespace ana;
25 
26 const Var kRun = SIMPLEVAR(hdr.run);
27 
28 const Var kEPH([](const caf::SRProxy* sr){
29  if (sr->slc.nhit == 0) return float(-1);
30  return float(sr->slc.calE/sr->slc.nhit);});
31 const Var kHadCalE([](const caf::SRProxy* sr){
32  if (!sr->vtx.elastic.IsValid) return float(-1);
33  if (sr->vtx.elastic.fuzzyk.nshwlid < 1) return float(sr->slc.calE);
34  return float(sr->slc.calE -
35  sr->vtx.elastic.fuzzyk.png[0].shwlid.calE);
36  });
37 const Var kShwLIDE([](const caf::SRProxy* sr){
38  if ( !sr->vtx.elastic.IsValid ) return float(-1);
39  if (sr->vtx.elastic.fuzzyk.nshwlid < 1) return float(-1);
40  return float(sr->vtx.elastic.fuzzyk.png[0].shwlid.calE);
41  });
42 const Var kShwLIDEPH([](const caf::SRProxy* sr){
43  if (!sr->vtx.elastic.IsValid ) return float(-1);
44  if (sr->vtx.elastic.fuzzyk.nshwlid < 1) return float(-1);
45  float cale = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
46  int nhit = sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;
47  float eph = (nhit > 0) ? cale/nhit : -1;
48  return eph;
49  });
50 
51 
52 
53 
54 
55 std::vector<Spectrum*> MakeCutFlowSpectra(SpectrumLoader *l,Var wei)
56 {
57  std::vector<Spectrum*> ret;
58  HistAxis axis("CalE",Binning::Simple(10,0,5),kCaloE);
59  //HistAxis axis = kNueSAEnergyAxis;
60 
61 
62  std::vector<Cut> cuts = {kNoCut};
63  cuts.push_back(kNueDQ2017CVN);
64  cuts.push_back(cuts.back() && kNue2017NDFiducial);
65  cuts.push_back(cuts.back() && kNue2017NDContain && kNue2017NDFrontPlanes);
66  cuts.push_back(cuts.back() && kNue2017NDNHits &&
68  cuts.push_back(cuts.back() && kCVNe>0.75);
69 
70  for (Cut cut : cuts)
71  ret.push_back(new Spectrum(*l,axis,cut,kNoShift,wei));
72 
73  return ret;
74 }
75 
76 std::vector<HistAxis> InitAxes()
77 {
78  std::vector<HistAxis> axes;
79 
80  axes.push_back(HistAxis("CalE",Binning::Simple(200,0,5),kCaloE));
81  axes.push_back(HistAxis("NHit",Binning::Simple(200,0,200),kNHit));
82  axes.push_back(HistAxis("NHit",Binning::Simple(200,0,0.05),kEPH));
83  axes.push_back(HistAxis("ShwE",Binning::Simple(200,0,5),kShwLIDE));
84  axes.push_back(HistAxis("ShwEPH",Binning::Simple(200,0,0.05),kShwLIDEPH));
85  axes.push_back(HistAxis("HadE",Binning::Simple(200,0,2),kHadCalE));
86  axes.push_back(HistAxis("pTp",Binning::Simple(100,0,1),kPtP));
87 
88  return axes;
89 }
90 
91 std::vector<Spectrum*> MakeKinSpectra(SpectrumLoader *l, Var wei, Cut sel)
92 {
93  std::vector<Spectrum*> ret;
94 
95  std::vector<HistAxis> axes = InitAxes();
96  for (HistAxis axis : axes)
97  ret.push_back(new Spectrum(*l,axis,sel,kNoShift,wei));
98 
99  return ret;
100 }
101 
102 std::vector<Spectrum*> MakeKin2DSpectra(SpectrumLoader *l, Var wei, Cut sel)
103 {
104  std::vector<Spectrum*> ret;
105 
106  HistAxis runaxis("Run",Binning::Simple(200,10300,12300),kRun);
107 
108  std::vector<HistAxis> axes = InitAxes();
109  for (HistAxis axis : axes)
110  ret.push_back(new Spectrum(*l,runaxis,axis,sel,kNoShift,wei));
111 
112  return ret;
113 }
114 
115 
116 // We want to measure the cutflow for events, and look at simple reco vars
117 // as a function of run number
119 {
120  SpectrumLoader *lDa2(new SpectrumLoader("prod_caf_R16-11-12-feature_caf_size.b_nd_numi_fhc_epochs1-3c_v1_goodruns"));
121  SpectrumLoader *lDa3(new SpectrumLoader("prod_caf_R17-03-01-prod3reco.d_nd_numi_fhc_full_v1_goodruns"));
122 
123  SpectrumLoader *lMC2(new SpectrumLoader("prod_caf_R16-11-12-feature_caf_size.b_nd_genie_nonswap_genierw_fhc_nova_v08_full_v1"));
124  SpectrumLoader *lMC3(new SpectrumLoader("prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1"));
125 
130 
132  Cut kNueND = kNue2017NDPresel && kCVNe > 0.75;
133 
134  std::vector<Spectrum*> mc_cutflow2 = MakeCutFlowSpectra(lMC2,wei);
135  std::vector<Spectrum*> mc_cutflow3 = MakeCutFlowSpectra(lMC3,wei);
136  std::vector<Spectrum*> da_cutflow2 = MakeCutFlowSpectra(lDa2,wei);
137  std::vector<Spectrum*> da_cutflow3 = MakeCutFlowSpectra(lDa3,wei);
138 
139  std::vector<Spectrum*> mc_kin2 = MakeKinSpectra(lMC2,wei,kNueND);
140  std::vector<Spectrum*> mc_kin3 = MakeKinSpectra(lMC3,wei,kNueND);
141  std::vector<Spectrum*> da_kin2 = MakeKinSpectra(lDa2,wei,kNueND);
142  std::vector<Spectrum*> da_kin3 = MakeKinSpectra(lDa3,wei,kNueND);
143 
144  std::vector<Spectrum*> mc_2D2 = MakeKin2DSpectra(lMC2,wei,kNueND);
145  std::vector<Spectrum*> mc_2D3 = MakeKin2DSpectra(lMC3,wei,kNueND);
146  std::vector<Spectrum*> da_2D2 = MakeKin2DSpectra(lDa2,wei,kNueND);
147  std::vector<Spectrum*> da_2D3 = MakeKin2DSpectra(lDa3,wei,kNueND);
148 
149  lDa2->Go();
150  lDa3->Go();
151  lMC2->Go();
152  lMC3->Go();
153 
154  std::cout << "fname " << fname << std::endl;
155  TFile *out = new TFile(fname.c_str(),"recreate");
156 
157  std::vector<std::string> cutname = {"nocut","dq","fiducial","contain",
158  "presel","ptp","cvn"};
159  assert(cutname.size() == da_cutflow2.size());
160  for (int cIdx = 0; cIdx < int(cutname.size()); cIdx++){
161  mc_cutflow2[cIdx]->SaveTo(out, ("prod2_mc_"+cutname[cIdx]).c_str());
162  mc_cutflow3[cIdx]->SaveTo(out, ("prod3_mc_"+cutname[cIdx]).c_str());
163 
164  da_cutflow2[cIdx]->SaveTo(out, ("prod2_da_"+cutname[cIdx]).c_str());
165  da_cutflow3[cIdx]->SaveTo(out, ("prod3_da_"+cutname[cIdx]).c_str());
166  }
167 
168  std::vector<std::string> varname = {"calE","NHit","EPH","shwE",
169  "shwEPH","HadE","pTp"};
170  assert(varname.size() == da_kin2.size());
171  for (int kIdx = 0; kIdx < int(varname.size()); kIdx++){
172  mc_kin2[kIdx]->SaveTo(out, ("prod2_mc_"+varname[kIdx]).c_str());
173  mc_kin3[kIdx]->SaveTo(out, ("prod3_mc_"+varname[kIdx]).c_str());
174  mc_2D2[kIdx]->SaveTo(out, ("prod2_mc_runvs"+varname[kIdx]).c_str());
175  mc_2D3[kIdx]->SaveTo(out, ("prod3_mc_runvs"+varname[kIdx]).c_str());
176 
177  da_kin2[kIdx]->SaveTo(out, ("prod2_da_"+varname[kIdx]).c_str());
178  da_kin3[kIdx]->SaveTo(out, ("prod3_da_"+varname[kIdx]).c_str());
179  da_2D2[kIdx]->SaveTo(out, ("prod2_da_runvs"+varname[kIdx]).c_str());
180  da_2D3[kIdx]->SaveTo(out, ("prod3_da_runvs"+varname[kIdx]).c_str());
181  }
182 }
183 
184 void CenterTitles(TH1 *h)
185 {
186  h->GetXaxis()->CenterTitle();
187  h->GetYaxis()->CenterTitle();
188 }
189 
191 {
192  TCanvas *can = new TCanvas();
193 
194  Spectrum *da_prod2=LoadFromFile<Spectrum>(fname,"prod2_da_"+name).release();
195  Spectrum *da_prod3=LoadFromFile<Spectrum>(fname,"prod3_da_"+name).release();
196  double da_pot2 = da_prod2->POT();
197  double da_pot3 = da_prod3->POT();
198  Spectrum *mc_prod2=LoadFromFile<Spectrum>(fname,"prod2_mc_"+name).release();
199  Spectrum *mc_prod3=LoadFromFile<Spectrum>(fname,"prod3_mc_"+name).release();
200  double mc_pot2 = mc_prod2->POT();
201  double mc_pot3 = mc_prod3->POT();
202 
203  TH1 *da2 = da_prod2->ToTH1(da_pot3);
204  TH1 *da3 = da_prod3->ToTH1(da_pot3);
205  TH1 *mc2 = mc_prod2->ToTH1(da_pot3);
206  TH1 *mc3 = mc_prod3->ToTH1(da_pot3);
207 
208  TH1 *rat_da2 = da_prod2->ToTH1(da_pot3);
209  TH1 *rat_da3 = da_prod3->ToTH1(da_pot3);
210  TH1 *rat_mc3 = mc_prod3->ToTH1(da_pot3);
211 
212  int nrebin = 1;
213  if (name == "EPH" || name == "shwEPH") nrebin = 10;
214  if (name == "calE" || name == "shwE" ||
215  name == "HadE" || name == "NHit") nrebin = 20;
216  da2->Rebin(nrebin);
217  da3->Rebin(nrebin);
218  mc2->Rebin(nrebin);
219  mc3->Rebin(nrebin);
220  rat_da2->Rebin(nrebin);
221  rat_da3->Rebin(nrebin);
222  rat_mc3->Rebin(nrebin);
223 
224  rat_da2->Divide(mc2);
225  rat_da3->Divide(mc2);
226  rat_mc3->Divide(mc2);
227 
228  TPad *pRat = new TPad(("rat"+name) .c_str(),"",0,0,1,0.35);
229  TPad *pSpec= new TPad(("spec"+name).c_str(),"",0,0.35,1,1);
230 
231  pRat->Draw();
232  pSpec->Draw();
233 
234  pSpec->cd();
235  gPad->SetBottomMargin(0);
236  mc2->SetLineColor(kBlue);
237  mc3->SetLineColor(kRed);
238  da2->SetLineColor(kGreen+2);
239  da3->SetLineColor(kBlack);
240  da2->SetMinimum(1e-3);
241 
242  double max = std::max(da2->GetMaximum(),da3->GetMaximum());
243  max = std::max(max,mc2->GetMaximum());
244  max = std::max(max,mc3->GetMaximum());
245 
246  da2->SetMaximum(1.2*max);
247  da2->GetXaxis()->SetTitle("");
248  da2->GetYaxis()->SetTitle("Events");
249  da2->SetTitle("");
250  CenterTitles(da2);
251  da2->GetXaxis()->SetTitleSize(0.06);
252  da2->Draw("E");
253  da3->Draw("E,same");
254  mc2->Draw("E,same");
255  mc3->Draw("E,same");
256  TLegend *leg = new TLegend(0.6,0.65,0.85,0.85);
257  leg->AddEntry(da2, "Data prod2", "le");
258  leg->AddEntry(mc2, "MC prod2", "le");
259  leg->AddEntry(da3, "Data prod3", "le");
260  leg->AddEntry(mc3, "MC prod3", "le");
261  leg->Draw();
262 
263  rat_mc3->SetLineColor(kRed);
264  rat_da2->SetLineColor(kGreen+2);
265  rat_da3->SetLineColor(kBlack);
266 
267  pRat->cd();
268  gPad->SetTopMargin(0);
269  gPad->SetBottomMargin(0.2);
270  rat_mc3->GetXaxis()->SetTitle(xtitle.c_str());
271  rat_mc3->GetYaxis()->SetTitle("Various Ratios");
272  rat_mc3->SetTitle("");
273  CenterTitles(rat_mc3);
274  rat_mc3->GetXaxis()->SetTitleSize(0.10);
275  rat_mc3->GetXaxis()->SetLabelSize(0.08);
276  rat_mc3->GetXaxis()->SetTitleOffset(0.8);
277  rat_mc3->GetYaxis()->SetTitleSize(0.10);
278  rat_mc3->GetYaxis()->SetLabelSize(0.08);
279  rat_mc3->GetYaxis()->SetTitleOffset(0.5);
280  rat_mc3->GetYaxis()->SetRangeUser(0.5001,1.4999);
281  rat_mc3->Draw();
282  rat_da2->Draw("same");
283  rat_da3->Draw("same");
284 
285  can->SaveAs(("Fig_nddatastability_"+name+".png").c_str());
286 }
287 
289 {
290  TCanvas *can = new TCanvas();
291 
292  Spectrum *mc_prod2 = LoadFromFile<Spectrum>(fname,"prod2_mc_runvs"+name).release();
293  Spectrum *mc_prod3 = LoadFromFile<Spectrum>(fname,"prod3_mc_runvs"+name).release();
294  Spectrum *da_prod2 = LoadFromFile<Spectrum>(fname,"prod2_da_runvs"+name).release();
295  Spectrum *da_prod3 = LoadFromFile<Spectrum>(fname,"prod3_da_runvs"+name).release();
296  double pot = da_prod3->POT();
297 
298  TH2F *mc2 = (TH2F*)mc_prod2->ToTH2(pot);
299  TH2F *mc3 = (TH2F*)mc_prod3->ToTH2(pot);
300  TH2F *da2 = (TH2F*)da_prod2->ToTH2(pot);
301  TH2F *da3 = (TH2F*)da_prod3->ToTH2(pot);
302 
303  int nrebin = 2;
304  if (name == "HadE" || name == "shwE")
305  nrebin = 4;
306  mc2->RebinX(nrebin);
307  mc3->RebinX(nrebin);
308  da2->RebinX(nrebin);
309  da3->RebinX(nrebin);
310 
311  TH1D *pmc2 = (TH1D*)mc2->ProfileX((name+"pmc2").c_str());
312  TH1D *pmc3 = (TH1D*)mc3->ProfileX((name+"pmc3").c_str());
313  TH1D *pda2 = (TH1D*)da2->ProfileX((name+"pda2").c_str());
314  TH1D *pda3 = (TH1D*)da3->ProfileX((name+"pda3").c_str());
315 
316  pmc2->SetLineColor(kBlue);
317  pmc3->SetLineColor(kRed);
318  pda2->SetLineColor(kGreen+2);
319  pda3->SetLineColor(kBlack);
320 
321  pda2->GetXaxis()->SetTitle("Run");
322  pda2->GetYaxis()->SetTitle(ytitle.c_str());
323  CenterTitles(pda2);
324 
325  int nnonzero = 0;
326  double avgval = 0;
327  for (int i = 1; i <= pda3->GetNbinsX(); i++){
328  double curcont = pda3->GetBinContent(i);
329  if (curcont != 0){
330  nnonzero++;
331  avgval += curcont;
332  }
333  }
334  avgval /= nnonzero;
335  pda2->GetYaxis()->SetRangeUser(0.5*avgval,1.5*avgval);
336 
337  pda2->Draw();
338  pda3->Draw("same");
339  pmc3->Draw("same");
340  pmc2->Draw("same");
341 
342  TLegend *leg = new TLegend(0.6,0.65,0.85,0.85);
343  leg->AddEntry(pda2, "Data prod2", "le");
344  leg->AddEntry(pmc2, "MC prod2", "le");
345  leg->AddEntry(pda3, "Data prod3", "le");
346  leg->AddEntry(pmc3, "MC prod3", "le");
347  leg->Draw();
348 
349 
350  can->SaveAs(("Fig_nddatastability_"+name+"_vsrun.png").c_str());
351 }
352 
353 
355 {
356  Make2DPlot(fname,"calE","CalE [GeV]");
357  Make2DPlot(fname,"NHit","NHit");
358  Make2DPlot(fname,"EPH","CalE / NHit [GeV]");
359  Make2DPlot(fname,"HadE","HadE [GeV]");
360  Make2DPlot(fname,"shwE","ShwE [GeV]");
361  Make2DPlot(fname,"shwEPH","ShwE / ShwNHit [GeV]");
362 
363 
364 
365  MakePlot(fname,"calE","CalE [GeV]");
366  MakePlot(fname,"NHit","NHit");
367  MakePlot(fname,"EPH","CalE / NHit [GeV]");
368  MakePlot(fname,"HadE","HadE [GeV]");
369  MakePlot(fname,"shwE","ShwE [GeV]");
370  MakePlot(fname,"shwEPH","ShwE / ShwNHit [GeV]");
371 
372  MakePlot(fname,"nocut","CalE [GeV]");
373  MakePlot(fname,"dq","CalE [GeV]");
374  MakePlot(fname,"fiducial","CalE [GeV]");
375  MakePlot(fname,"contain","CalE [GeV]");
376  MakePlot(fname,"presel","CalE [GeV]");
377  MakePlot(fname,"ptp","CalE [GeV]");
378  MakePlot(fname,"cvn","CalE [GeV]");
379 }
380 
381 
382 void nd_datastability(bool fillSpectra, std::string fname)
383 {
384  if (fillSpectra)
385  CreateAndFillSpectra(fname);
386  else
387  MakePlots(fname);
388 
389 }
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:1964
T max(const caf::Proxy< T > &a, T b)
const XML_Char * name
Definition: expat.h:151
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:1983
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:226
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kNue2017NDEnergy
Definition: NueCuts2017.h:271
const Var kCVNe
PID
Definition: Vars.cxx:35
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
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.
Definition: Spectrum.cxx:209
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2038
std::vector< Spectrum * > MakeKinSpectra(SpectrumLoader *l, Var wei, Cut sel)
const Cut kNueDQ2017CVN([](const caf::SRProxy *sr){if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(!sr->vtx.elastic.IsValid) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return true;})
Definition: NueCuts2017.h:28
nhit
Definition: demo1.py:25
void SetSpillCut(const SpillCut &cut)
void CenterTitles(TH1 *histo)
Definition: Plots.cxx:1481
void Make2DPlot(std::string fname, std::string name, std::string ytitle)
const Cut kNue2017NDProngLength
Definition: NueCuts2017.h:277
const Var kHadCalE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return float(sr->slc.calE);if(sr->vtx.elastic.fuzzyk.nshwlid< 1) return float(sr->slc.calE);return((sr->slc.calE- sr->vtx.elastic.fuzzyk.png[0].shwlid.calE));})
Definition: NueVarsExtra.h:40
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:33
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2030
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:1967
void CreateAndFillSpectra(std::string fname)
const Var kPtP
Transverse momentum fraction in slice.
Definition: NueVars.cxx:90
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1262
const Cut kNue2017NDNHits
Definition: NueCuts2017.h:265
if(dump)
const Var kCaloE
Summed calorimetric energy of all hits in slice, uncorrected.
Definition: Vars.cxx:52
const Var kNHit
Definition: Vars.cxx:71
const Var kShwLIDE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return float(-1);if(sr->vtx.elastic.fuzzyk.nshwlid< 1) return float(-1);return float(sr->vtx.elastic.fuzzyk.png[0].shwlid.calE);})
void MakePlot(std::string fname, std::string name, std::string xtitle)
#define pot
virtual void Go() override
Load all the registered spectra.
const Cut kNue2017NDFrontPlanes
No hits in the first 5 planes of the detector, doc 12879.
std::vector< float > Spectrum
Definition: Constants.h:527
double POT() const
Definition: Spectrum.h:231
std::vector< HistAxis > InitAxes()
const SystShifts kNoShift
Definition: SystShifts.h:115
OStream cout
Definition: OStream.cxx:6
const Cut kNue2017NDPresel
Definition: NueCuts2017.h:285
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:94
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Cut cut
Definition: exporter_fd.C:30
caf::Proxy< bool > IsValid
Definition: SRProxy.h:1982
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2054
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
caf::Proxy< float > calE
Definition: SRProxy.h:1239
GenericHistAxis< Var > HistAxis
Definition: HistAxis.h:111
const Cut kNue2017NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){TVector3 start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;TVector3 stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -170.0) return false;if(std::max(start.X(), stop.X()) > 170.0) return false;if(std::min(start.Y(), stop.Y())< -170.0) return false;if(std::max(start.Y(), stop.Y()) > 170.0) return false;if(std::min(start.Z(), stop.Z())< 100.0) return false;if(std::max(start.Z(), stop.Z()) > 1225.0) return false;}return true;})
Loose containtment on start and end of all showers, docdb-12943.
Definition: NueCuts2017.h:259
std::vector< Spectrum * > MakeKin2DSpectra(SpectrumLoader *l, Var wei, Cut sel)
assert(nhit_max >=nhit_nbins)
std::vector< Spectrum * > MakeCutFlowSpectra(SpectrumLoader *l, Var wei)
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:46
const Var kRun
Definition: Vars.cxx:20
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2058
const Var kXSecCVWgt2017
Definition: XsecTunes.h:37
Float_t e
Definition: plot.C:35
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
void nd_datastability(bool fillSpectra, std::string fname)
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:38
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:117
const Var kEPH([](const caf::SRProxy *sr){if(sr->slc.nhit==0) return float(-1);return float(sr->slc.calE/sr->slc.nhit);})
void MakePlots(std::string fname)
static constexpr Double_t sr
Definition: Munits.h:164
const Cut kNue2017NDFiducial([](const caf::SRProxy *sr){assert(sr->vtx.elastic.IsValid &&"Must apply DQ cuts");if(sr->vtx.elastic.vtx.X()< -100.0) return false;if(sr->vtx.elastic.vtx.X() > 160.0) return false;if(sr->vtx.elastic.vtx.Y()< -160.0) return false;if(sr->vtx.elastic.vtx.Y() > 100.0) return false;if(sr->vtx.elastic.vtx.Z()< 150.0) return false;if(sr->vtx.elastic.vtx.Z() > 900.0) return false;return true;})
Cut on ND vertex position.
Definition: NueCuts2017.h:256
const Var kShwLIDEPH([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return float(-1);if(sr->vtx.elastic.fuzzyk.nshwlid< 1) return float(-1);float cale=sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;int nhit=sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;float eph=(nhit > 0)?cale/nhit:-1;return eph;})