CutTableLoad.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Loaders.h"
3 #include "NuXAna/Cuts/NusCuts.h"
9 #include "CAFAna/Vars/HistAxes.h"
10 #include "CAFAna/Vars/Vars.h"
12 #include "NuXAna/Vars/HistAxes.h"
13 
14 using namespace ana;
15 
17 {
18  TH1::AddDirectory(0);
19 
20  // Set up the files to be loaded
27 
28  // Only consider 14 diblock files for beam files
30  //loaders.SetSpillCut(kStandardSpillCuts);
31 
32  // Loader for the cosmics
35  //floadcos.SetSpillCut(kStandardSpillCuts);
36 
37  std::string labelVtxX = "X Vertex Position (cm)";
38  std::string labelVtxY = "Y Vertex Position (cm)";
39  std::string labelVtxZ = "Z Vertex Position (cm)";
40  std::string labelCont = "Minimum Distance to Any Detector Face (cm)";
41  std::string labelHits = "Number of Hits";
42  std::string labelCVN = "CVN NC Classifier";
43  std::string labelLID = "LID";
44  std::string labelRemID = "RemID";
45  std::string labelNCP = "Cosmic Rejection BDT";
46  std::string labelPTP = "p_{T}/p";
47  std::string labelIsMuon = "Is Muon";
48  std::string labelEPerHit = "Average E/Hit (GeV)";
49  std::string labelTop = "Distance to Top of Detector (cm)";
50 
51  Binning kXYBinsFD = Binning::Simple(320, -800., 800.);
52  Binning kZBinsFD = Binning::Simple(1210, -50., 6000.);
53  Binning kNearEdgeBins = Binning::Simple(160, 0., 800.);
54  Binning kFinePIDBins = Binning::Simple(100, 0., 1.);
55  Binning kHitBins = Binning::Simple(800, 0., 800.);
56  Binning kEDepBins = Binning::Simple(1000, 0., 1.);
57 
58  // Variables for reconstructed vertex
59  const Var kRecoVtxX(
60  [](const caf::SRProxy* sr)
61  {
62  if(!sr->vtx.elastic.IsValid) { return 9000.; }
63  return sr->vtx.elastic.vtx.x;
64  });
65  const Var kRecoVtxY(
66  [](const caf::SRProxy* sr)
67  {
68  if(!sr->vtx.elastic.IsValid ) { return 9000.; }
69  return sr->vtx.elastic.vtx.y;
70  });
71  const Var kRecoVtxZ(
72  [](const caf::SRProxy* sr)
73  {
74  if(!sr->vtx.elastic.IsValid) { return 9000.; }
75  return sr->vtx.elastic.vtx.z;
76  });
77 
78  const Var kMinDistP(
79  [](const caf::SRProxy* sr)
80  {
81  const caf::SRNueCosRej& cr = sr->sel.nuecosrej;
82  float mindist = 10000.;
83  mindist = std::min(mindist, std::min(cr.starteast, cr.stopeast));
84  mindist = std::min(mindist, std::min(cr.startwest, cr.stopwest));
85  mindist = std::min(mindist, std::min(cr.starttop, cr.stoptop));
86  mindist = std::min(mindist, std::min(cr.startbottom, cr.stopbottom));
87  mindist = std::min(mindist, std::min(cr.startfront, cr.stopfront));
88  mindist = std::min(mindist, std::min(cr.startback, cr.stopback));
89  return (mindist > 9999. ? (float)-1. : mindist);
90  });
91 
92  const Var kNCP = SIMPLEVAR(sel.cosrej.numucontpid);
93  const Var kPartPTP = SIMPLEVAR(sel.nuecosrej.partptp);
94  const Var kIsMuon([](const caf::SRProxy* sr)
95  {
96  if(sr->vtx.elastic.fuzzyk.nshwlid < 1) { return -1; }
97  return sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon;
98  });
99  const Var kEPerHit(
100  [](const caf::SRProxy* sr)
101  {
102  double nhit = (double)sr->slc.nhit;
103  if(nhit <= 0.) { return 0.; }
104  return sr->slc.calE/nhit;
105  });
106  const Var kDistTop(
107  [](const caf::SRProxy* sr)
108  {
110  });
111 
112  const HistAxis kAxisVtxX(labelVtxX, kXYBinsFD, kRecoVtxX);
113  const HistAxis kAxisVtxY(labelVtxY, kXYBinsFD, kRecoVtxY);
114  const HistAxis kAxisVtxZ(labelVtxZ, kZBinsFD, kRecoVtxZ);
115  const HistAxis kAxisCont(labelCont, kNearEdgeBins, kMinDistP);
116  const HistAxis kAxisCVN( labelCVN, kFinePIDBins, kCVNnc);
117  const HistAxis kAxisLID( labelLID, kFinePIDBins, kElecID);
118  const HistAxis kAxisRem( labelRemID, kFinePIDBins, kRemID);
119  const HistAxis kAxisNHit(labelHits, kHitBins, kNHit);
120  const HistAxis kAxisNCP( labelNCP, kFinePIDBins, kNCP);
121  const HistAxis kAxisPTP( labelPTP, kFinePIDBins, kPartPTP);
122  const HistAxis kAxisIsMu(labelIsMuon, kBooleanBins, kIsMuon);
123  const HistAxis kAxisEpH( labelEPerHit, kEDepBins, kEPerHit);
124  const HistAxis kAxisTop( labelTop, kNearEdgeBins, kDistTop);
125 
126  const Cut kNM1Fid = kNusEventQuality && kNusFDContain && kNusCosRej && kNusNCSel;
127  const Cut kNM1Cont = kNusEventQuality && kNusFDFiducial && kNusCosRej && kNusNCSel;
128  const Cut kNM1NCSel = kNusFDPresel && kNusCosRej;
129  const Cut kNM1CosRej = kNusFDPresel && kNusNCSel;
130 
131  const Cut kFidMinusX(
132  [](const caf::SRProxy* sr)
133  {
134  if( !sr->vtx.elastic.IsValid ) return false;
135 
136  const TVector3 vtx = sr->vtx.elastic.vtx;
137  if(vtx.Y() < -720.0) return false;
138  if(vtx.Y() > 600.0) return false;
139  if(vtx.Z() < 50.0) return false;
140  if(vtx.Z() > 5450.0) return false;
141  return true;
142  });
143  const Cut kFidMinusY(
144  [](const caf::SRProxy* sr)
145  {
146  if(!sr->vtx.elastic.IsValid ) return false;
147 
148  const TVector3 vtx = sr->vtx.elastic.vtx;
149  if(vtx.X() < -680.0) return false;
150  if(vtx.X() > 650.0) return false;
151  if(vtx.Z() < 50.0) return false;
152  if(vtx.Z() > 5450.0) return false;
153  return true;
154  });
155  const Cut kFidMinusZ(
156  [](const caf::SRProxy* sr)
157  {
158  if( !sr->vtx.elastic.IsValid ) return false;
159 
160  const TVector3 vtx = sr->vtx.elastic.vtx;
161  if(vtx.X() < -680.0) return false;
162  if(vtx.X() > 650.0) return false;
163  if(vtx.Y() < -720.0) return false;
164  if(vtx.Y() > 600.0) return false;
165  return true;
166  });
167 
168  const Cut kNCSelMinusHit(
169  [](const caf::SRProxy* sr)
170  {
171  if(sr->sel.cvn.ncid < 0.2) return false;
172  return true;
173  });
174  const Cut kNCSelMinusCVN(
175  [](const caf::SRProxy* sr)
176  {
177  if(sr->slc.nhit >= 200) return false;
178  return true;
179  });
180 
181  const Cut kCosRejMinusNCP(
182  [](const caf::SRProxy* sr)
183  {
184  double partptp = sr->sel.nuecosrej.partptp;
185  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
186  if(partptp >= 0.8) return false;
187  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon == 1) return false;
188  double nhit = (double)sr->slc.nhit;
189  if(nhit <= 0.) return false;
190  if(sr->slc.calE/nhit <= 0.018) return false;
191  if(std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop) < 480) return false;
192  return true;
193  });
194  const Cut kCosRejMinusPTP(
195  [](const caf::SRProxy* sr)
196  {
197  double numucontpid = sr->sel.cosrej.numucontpid;
198  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
199  if(numucontpid <= 0.5) return false;
200  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon == 1) return false;
201  double nhit = (double)sr->slc.nhit;
202  if(nhit <= 0.) return false;
203  if(sr->slc.calE/nhit <= 0.018) return false;
204  if(std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop) < 480) return false;
205  return true;
206  });
207  const Cut kCosRejMinusIsM(
208  [](const caf::SRProxy* sr)
209  {
210  double numucontpid = sr->sel.cosrej.numucontpid;
211  double partptp = sr->sel.nuecosrej.partptp;
212  if(numucontpid <= 0.5) return false;
213  if(partptp >= 0.8) return false;
214  double nhit = (double)sr->slc.nhit;
215  if(nhit <= 0.) return false;
216  if(sr->slc.calE/nhit <= 0.018) return false;
217  if(std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop) < 480) return false;
218  return true;
219  });
220  const Cut kCosRejMinusEpH(
221  [](const caf::SRProxy* sr)
222  {
223  double numucontpid = sr->sel.cosrej.numucontpid;
224  double partptp = sr->sel.nuecosrej.partptp;
225  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
226  if(numucontpid <= 0.5) return false;
227  if(partptp >= 0.8) return false;
228  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon == 1) return false;
229  if(std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop) < 480) return false;
230  return true;
231  });
232  const Cut kCosRejMinusTop(
233  [](const caf::SRProxy* sr)
234  {
235  double numucontpid = sr->sel.cosrej.numucontpid;
236  double partptp = sr->sel.nuecosrej.partptp;
237  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
238  if(numucontpid <= 0.5) return false;
239  if(partptp >= 0.8) return false;
240  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon == 1) return false;
241  double nhit = (double)sr->slc.nhit;
242  if(nhit <= 0.) return false;
243  if(sr->slc.calE/nhit <= 0.018) return false;
244  return true;
245  });
246 
247  // Set up the necessary objects for the ND Cut Table
251  ProportionalDecomp dND_Reco3(loaders, kNCAxis, kNusNDPresel, kNoShift, kNoShift, kTuftsWeightCC); // Adds containment
252  ProportionalDecomp dND_Reco4(loaders, kNCAxis, kNusNDPresel && kNusCosRejMod, kNoShift, kNoShift, kTuftsWeightCC); // Adds PIDs
253  ProportionalDecomp dND_Reco5(loaders, kNCAxis, kNusND, kNoShift, kNoShift, kTuftsWeightCC); // This actually cuts all ND events...
254 
255  // Set up the objects containing the beam events for the FD Cut Table,
260  PredictionNoExtrap pFD_Reco4(loaders, kNCAxis, kNusFDPresel && kNusCosRej, kNoShift, kTuftsWeightCC);
261  PredictionNoExtrap pFD_Reco5(loaders, kNCAxis, kNusFD, kNoShift, kTuftsWeightCC); // Adds cosrej
262 
263  // Set up the objects containing the cosmic events for the FD Cut table
264  Spectrum sCS_Reco0(floadcos, kNCAxis, kInCosmicTimingWindow);
265  Spectrum sCS_Reco1(floadcos, kNCAxis, kInCosmicTimingWindow && kNusEventQuality);
267  Spectrum sCS_Reco3(floadcos, kNCAxis, kInCosmicTimingWindow && kNusFDPresel);
268  Spectrum sCS_Reco4(floadcos, kNCAxis, kInCosmicTimingWindow && kNusFDPresel && kNusCosRej);
269  Spectrum sCS_Reco5(floadcos, kNCAxis, kInCosmicTimingWindow && kNusFD);
270 
271  // Set up distributions of variables used for the NEXT cut level
272  PredictionNoExtrap pFD_VertexX1( loaders, kAxisVtxX, kNusEventQuality, kNoShift, kTuftsWeightCC);
273  PredictionNoExtrap pFD_VertexY1( loaders, kAxisVtxY, kNusEventQuality, kNoShift, kTuftsWeightCC);
274  PredictionNoExtrap pFD_VertexZ1( loaders, kAxisVtxZ, kNusEventQuality, kNoShift, kTuftsWeightCC);
275  PredictionNoExtrap pFD_Contain1( loaders, kAxisCont, kNusEventQuality, kNoShift, kTuftsWeightCC);
276  PredictionNoExtrap pFD_NHit3( loaders, kAxisNHit, kNusFDPresel, kNoShift, kTuftsWeightCC);
277  PredictionNoExtrap pFD_CVN3( loaders, kAxisCVN, kNusFDPresel, kNoShift, kTuftsWeightCC);
278  PredictionNoExtrap pFD_LID3( loaders, kAxisLID, kNusFDPresel, kNoShift, kTuftsWeightCC);
279  PredictionNoExtrap pFD_Rem3( loaders, kAxisRem, kNusFDPresel, kNoShift, kTuftsWeightCC);
280  PredictionNoExtrap pFD_NumucontPID4(loaders, kAxisNCP, kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
281  PredictionNoExtrap pFD_PartPTP4( loaders, kAxisPTP, kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
282  PredictionNoExtrap pFD_IsMu4( loaders, kAxisIsMu, kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
283  PredictionNoExtrap pFD_EperHit4( loaders, kAxisEpH, kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
284  PredictionNoExtrap pFD_DistTop4( loaders, kAxisTop, kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
285 
286  Spectrum sCS_VertexX1( floadcos, kAxisVtxX, kInCosmicTimingWindow && kNusEventQuality, kNoShift, kTuftsWeightCC);
287  Spectrum sCS_VertexY1( floadcos, kAxisVtxY, kInCosmicTimingWindow && kNusEventQuality, kNoShift, kTuftsWeightCC);
288  Spectrum sCS_VertexZ1( floadcos, kAxisVtxZ, kInCosmicTimingWindow && kNusEventQuality, kNoShift, kTuftsWeightCC);
289  Spectrum sCS_Contain1( floadcos, kAxisCont, kInCosmicTimingWindow && kNusEventQuality, kNoShift, kTuftsWeightCC);
290  Spectrum sCS_NHit3( floadcos, kAxisNHit, kInCosmicTimingWindow && kNusFDPresel, kNoShift, kTuftsWeightCC);
291  Spectrum sCS_CVN3( floadcos, kAxisCVN, kInCosmicTimingWindow && kNusFDPresel, kNoShift, kTuftsWeightCC);
292  Spectrum sCS_LID3( floadcos, kAxisLID, kInCosmicTimingWindow && kNusFDPresel, kNoShift, kTuftsWeightCC);
293  Spectrum sCS_Rem3( floadcos, kAxisRem, kInCosmicTimingWindow && kNusFDPresel, kNoShift, kTuftsWeightCC);
294  Spectrum sCS_NumucontPID4(floadcos, kAxisNCP, kInCosmicTimingWindow && kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
295  Spectrum sCS_PartPTP4( floadcos, kAxisPTP, kInCosmicTimingWindow && kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
296  Spectrum sCS_IsMu4( floadcos, kAxisIsMu, kInCosmicTimingWindow && kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
297  Spectrum sCS_EperHit4( floadcos, kAxisEpH, kInCosmicTimingWindow && kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
298  Spectrum sCS_DistTop4( floadcos, kAxisTop, kInCosmicTimingWindow && kNusFDPresel && kNusNCSel, kNoShift, kTuftsWeightCC);
299 
300  // Set up N-1 distributions
301  PredictionNoExtrap pNM1_VertexX( loaders, kAxisVtxX, kNM1Fid && kFidMinusX, kNoShift, kTuftsWeightCC);
302  PredictionNoExtrap pNM1_VertexY( loaders, kAxisVtxY, kNM1Fid && kFidMinusY, kNoShift, kTuftsWeightCC);
303  PredictionNoExtrap pNM1_VertexZ( loaders, kAxisVtxZ, kNM1Fid && kFidMinusZ, kNoShift, kTuftsWeightCC);
304  PredictionNoExtrap pNM1_Contain( loaders, kAxisCont, kNM1Cont, kNoShift, kTuftsWeightCC);
305  PredictionNoExtrap pNM1_NHit( loaders, kAxisNHit, kNM1NCSel && kNCSelMinusHit, kNoShift, kTuftsWeightCC);
306  PredictionNoExtrap pNM1_CVN( loaders, kAxisCVN, kNM1NCSel && kNCSelMinusCVN, kNoShift, kTuftsWeightCC);
307  PredictionNoExtrap pNM1_LID( loaders, kAxisLID, kNusFD, kNoShift, kTuftsWeightCC);
308  PredictionNoExtrap pNM1_Rem( loaders, kAxisRem, kNusFD, kNoShift, kTuftsWeightCC);
309  PredictionNoExtrap pNM1_NumucontPID(loaders, kAxisNCP, kNM1CosRej && kCosRejMinusNCP, kNoShift, kTuftsWeightCC);
310  PredictionNoExtrap pNM1_PartPTP( loaders, kAxisPTP, kNM1CosRej && kCosRejMinusPTP, kNoShift, kTuftsWeightCC);
311  PredictionNoExtrap pNM1_IsMu( loaders, kAxisIsMu, kNM1CosRej && kCosRejMinusIsM, kNoShift, kTuftsWeightCC);
312  PredictionNoExtrap pNM1_EperHit( loaders, kAxisEpH, kNM1CosRej && kCosRejMinusEpH, kNoShift, kTuftsWeightCC);
313  PredictionNoExtrap pNM1_DistTop( loaders, kAxisTop, kNM1CosRej && kCosRejMinusTop, kNoShift, kTuftsWeightCC);
314 
315  Spectrum sNM1_VertexX( floadcos, kAxisVtxX, kInCosmicTimingWindow && kNM1Fid && kFidMinusX, kNoShift, kTuftsWeightCC);
316  Spectrum sNM1_VertexY( floadcos, kAxisVtxY, kInCosmicTimingWindow && kNM1Fid && kFidMinusY, kNoShift, kTuftsWeightCC);
317  Spectrum sNM1_VertexZ( floadcos, kAxisVtxZ, kInCosmicTimingWindow && kNM1Fid && kFidMinusZ, kNoShift, kTuftsWeightCC);
318  Spectrum sNM1_Contain( floadcos, kAxisCont, kInCosmicTimingWindow && kNM1Cont, kNoShift, kTuftsWeightCC);
319  Spectrum sNM1_NHit( floadcos, kAxisNHit, kInCosmicTimingWindow && kNM1NCSel && kNCSelMinusHit, kNoShift, kTuftsWeightCC);
320  Spectrum sNM1_CVN( floadcos, kAxisCVN, kInCosmicTimingWindow && kNM1NCSel && kNCSelMinusCVN, kNoShift, kTuftsWeightCC);
321  Spectrum sNM1_LID( floadcos, kAxisLID, kInCosmicTimingWindow && kNusFD, kNoShift, kTuftsWeightCC);
322  Spectrum sNM1_Rem( floadcos, kAxisRem, kInCosmicTimingWindow && kNusFD, kNoShift, kTuftsWeightCC);
323  Spectrum sNM1_NumucontPID(floadcos, kAxisNCP, kInCosmicTimingWindow && kNM1CosRej && kCosRejMinusNCP, kNoShift, kTuftsWeightCC);
324  Spectrum sNM1_PartPTP( floadcos, kAxisPTP, kInCosmicTimingWindow && kNM1CosRej && kCosRejMinusPTP, kNoShift, kTuftsWeightCC);
325  Spectrum sNM1_IsMu( floadcos, kAxisIsMu, kInCosmicTimingWindow && kNM1CosRej && kCosRejMinusIsM, kNoShift, kTuftsWeightCC);
326  Spectrum sNM1_EperHit( floadcos, kAxisEpH, kInCosmicTimingWindow && kNM1CosRej && kCosRejMinusEpH, kNoShift, kTuftsWeightCC);
327  Spectrum sNM1_DistTop( floadcos, kAxisTop, kInCosmicTimingWindow && kNM1CosRej && kCosRejMinusTop, kNoShift, kTuftsWeightCC);
328 
329  // Fill the spectra!
330  loaders.Go();
331  floadcos.Go();
332 
333  // Set up and create the file to save the loaded objects
334  TFile* rootF = new TFile(outfile.c_str(), "RECREATE");
335  TDirectory* tmp = gDirectory;
336  TDirectory* saveDir = gDirectory;
337 
338  // Save the CAFAna objects to file
339  saveDir = rootF->mkdir("dND_Reco0");
340  dND_Reco0.SaveTo(saveDir);
341  saveDir = rootF->mkdir("dND_Reco1");
342  dND_Reco1.SaveTo(saveDir);
343  saveDir = rootF->mkdir("dND_Reco2");
344  dND_Reco2.SaveTo(saveDir);
345  saveDir = rootF->mkdir("dND_Reco3");
346  dND_Reco3.SaveTo(saveDir);
347  saveDir = rootF->mkdir("dND_Reco4");
348  dND_Reco4.SaveTo(saveDir);
349  saveDir = rootF->mkdir("dND_Reco5");
350  dND_Reco5.SaveTo(saveDir);
351 
352  saveDir = rootF->mkdir("pFD_Reco0");
353  pFD_Reco0.SaveTo(saveDir);
354  saveDir = rootF->mkdir("pFD_Reco1");
355  pFD_Reco1.SaveTo(saveDir);
356  saveDir = rootF->mkdir("pFD_Reco2");
357  pFD_Reco2.SaveTo(saveDir);
358  saveDir = rootF->mkdir("pFD_Reco3");
359  pFD_Reco3.SaveTo(saveDir);
360  saveDir = rootF->mkdir("pFD_Reco4");
361  pFD_Reco4.SaveTo(saveDir);
362  saveDir = rootF->mkdir("pFD_Reco5");
363  pFD_Reco5.SaveTo(saveDir);
364 
365  saveDir = rootF->mkdir("sCS_Reco0");
366  sCS_Reco0.SaveTo(saveDir);
367  saveDir = rootF->mkdir("sCS_Reco1");
368  sCS_Reco1.SaveTo(saveDir);
369  saveDir = rootF->mkdir("sCS_Reco2");
370  sCS_Reco2.SaveTo(saveDir);
371  saveDir = rootF->mkdir("sCS_Reco3");
372  sCS_Reco3.SaveTo(saveDir);
373  saveDir = rootF->mkdir("sCS_Reco4");
374  sCS_Reco4.SaveTo(saveDir);
375  saveDir = rootF->mkdir("sCS_Reco5");
376  sCS_Reco5.SaveTo(saveDir);
377 
378  saveDir = rootF->mkdir("pFD_VertexX1");
379  pFD_VertexX1.SaveTo(saveDir);
380  saveDir = rootF->mkdir("pFD_VertexY1");
381  pFD_VertexY1.SaveTo(saveDir);
382  saveDir = rootF->mkdir("pFD_VertexZ1");
383  pFD_VertexZ1.SaveTo(saveDir);
384  saveDir = rootF->mkdir("pFD_Contain1");
385  pFD_Contain1.SaveTo(saveDir);
386  saveDir = rootF->mkdir("pFD_NHit3");
387  pFD_NHit3.SaveTo(saveDir);
388  saveDir = rootF->mkdir("pFD_CVN3");
389  pFD_CVN3.SaveTo(saveDir);
390  saveDir = rootF->mkdir("pFD_LID3");
391  pFD_LID3.SaveTo(saveDir);
392  saveDir = rootF->mkdir("pFD_Rem3");
393  pFD_Rem3.SaveTo(saveDir);
394  saveDir = rootF->mkdir("pFD_NumucontPID4");
395  pFD_NumucontPID4.SaveTo(saveDir);
396  saveDir = rootF->mkdir("pFD_PartPTP4");
397  pFD_PartPTP4.SaveTo(saveDir);
398  saveDir = rootF->mkdir("pFD_IsMu4");
399  pFD_IsMu4.SaveTo(saveDir);
400  saveDir = rootF->mkdir("pFD_EperHit4");
401  pFD_EperHit4.SaveTo(saveDir);
402  saveDir = rootF->mkdir("pFD_DistTop4");
403  pFD_DistTop4.SaveTo(saveDir);
404 
405  saveDir = rootF->mkdir("sCS_VertexX1");
406  sCS_VertexX1.SaveTo(saveDir);
407  saveDir = rootF->mkdir("sCS_VertexY1");
408  sCS_VertexY1.SaveTo(saveDir);
409  saveDir = rootF->mkdir("sCS_VertexZ1");
410  sCS_VertexZ1.SaveTo(saveDir);
411  saveDir = rootF->mkdir("sCS_Contain1");
412  sCS_Contain1.SaveTo(saveDir);
413  saveDir = rootF->mkdir("sCS_NHit3");
414  sCS_NHit3.SaveTo(saveDir);
415  saveDir = rootF->mkdir("sCS_Rem3");
416  sCS_Rem3.SaveTo(saveDir);
417  saveDir = rootF->mkdir("sCS_LID3");
418  sCS_LID3.SaveTo(saveDir);
419  saveDir = rootF->mkdir("sCS_CVN3");
420  sCS_CVN3.SaveTo(saveDir);
421  saveDir = rootF->mkdir("sCS_NumucontPID4");
422  sCS_NumucontPID4.SaveTo(saveDir);
423  saveDir = rootF->mkdir("sCS_PartPTP4");
424  sCS_PartPTP4.SaveTo(saveDir);
425  saveDir = rootF->mkdir("sCS_IsMu4");
426  sCS_IsMu4.SaveTo(saveDir);
427  saveDir = rootF->mkdir("sCS_EperHit4");
428  sCS_EperHit4.SaveTo(saveDir);
429  saveDir = rootF->mkdir("sCS_DistTop4");
430  sCS_DistTop4.SaveTo(saveDir);
431 
432  saveDir = rootF->mkdir("pNM1_VertexX");
433  pNM1_VertexX.SaveTo(saveDir);
434  saveDir = rootF->mkdir("pNM1_VertexY");
435  pNM1_VertexY.SaveTo(saveDir);
436  saveDir = rootF->mkdir("pNM1_VertexZ");
437  pNM1_VertexZ.SaveTo(saveDir);
438  saveDir = rootF->mkdir("pNM1_Contain");
439  pNM1_Contain.SaveTo(saveDir);
440  saveDir = rootF->mkdir("pNM1_NHit");
441  pNM1_NHit.SaveTo(saveDir);
442  saveDir = rootF->mkdir("pNM1_Rem");
443  pNM1_Rem.SaveTo(saveDir);
444  saveDir = rootF->mkdir("pNM1_LID");
445  pNM1_LID.SaveTo(saveDir);
446  saveDir = rootF->mkdir("pNM1_CVN");
447  pNM1_CVN.SaveTo(saveDir);
448  saveDir = rootF->mkdir("pNM1_NumucontPID");
449  pNM1_NumucontPID.SaveTo(saveDir);
450  saveDir = rootF->mkdir("pNM1_PartPTP");
451  pNM1_PartPTP.SaveTo(saveDir);
452  saveDir = rootF->mkdir("pNM1_IsMu");
453  pNM1_IsMu.SaveTo(saveDir);
454  saveDir = rootF->mkdir("pNM1_EperHit");
455  pNM1_EperHit.SaveTo(saveDir);
456  saveDir = rootF->mkdir("pNM1_DistTop");
457  pNM1_DistTop.SaveTo(saveDir);
458 
459  saveDir = rootF->mkdir("sNM1_VertexX");
460  sNM1_VertexX.SaveTo(saveDir);
461  saveDir = rootF->mkdir("sNM1_VertexY");
462  sNM1_VertexY.SaveTo(saveDir);
463  saveDir = rootF->mkdir("sNM1_VertexZ");
464  sNM1_VertexZ.SaveTo(saveDir);
465  saveDir = rootF->mkdir("sNM1_Contain");
466  sNM1_Contain.SaveTo(saveDir);
467  saveDir = rootF->mkdir("sNM1_NHit");
468  sNM1_NHit.SaveTo(saveDir);
469  saveDir = rootF->mkdir("sNM1_Rem");
470  sNM1_Rem.SaveTo(saveDir);
471  saveDir = rootF->mkdir("sNM1_LID");
472  sNM1_LID.SaveTo(saveDir);
473  saveDir = rootF->mkdir("sNM1_CVN");
474  sNM1_CVN.SaveTo(saveDir);
475  saveDir = rootF->mkdir("sNM1_NumucontPID");
476  sNM1_NumucontPID.SaveTo(saveDir);
477  saveDir = rootF->mkdir("sNM1_PartPTP");
478  sNM1_PartPTP.SaveTo(saveDir);
479  saveDir = rootF->mkdir("sNM1_IsMu");
480  sNM1_IsMu.SaveTo(saveDir);
481  saveDir = rootF->mkdir("sNM1_EperHit");
482  sNM1_EperHit.SaveTo(saveDir);
483  saveDir = rootF->mkdir("sNM1_DistTop");
484  sNM1_DistTop.SaveTo(saveDir);
485 
486  // Close the file
487  tmp->cd();
488  rootF->Close();
489 }
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:1999
Near Detector underground.
Definition: SREnums.h:10
const Cut kNusFDFiducial([](const caf::SRProxy *sr){ if(!sr->vtx.elastic.IsValid) return false;const TVector3 vtx=sr->vtx.elastic.vtx;if(vtx.X()< -680.0) return false;if(vtx.X() > 650.0) return false;if(vtx.Y()< -720.0) return false;if(vtx.Y() > 500.0) return false;if(vtx.Z()< 50.0) return false;if(vtx.Z() > 5450.0) return false;return true;})
FD Fiducial volume from docdb 15285.
Definition: NusCuts.h:17
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2018
Far Detector at Ash River.
Definition: SREnums.h:11
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
float partptp
Definition: NusVarsTemp.cxx:50
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
caf::Proxy< float > stoptop
Definition: SRProxy.h:1036
const std::string fnametau_concat
const Var kCVNnc
PID
Definition: Vars.cxx:44
const Cut kNusEventQuality([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.gap >=100.) return false;if(sr->slc.ncontplanes<=2) return false;return true;})
Data Quality cuts from docdb 14241.
Definition: NusCuts.h:14
const Var kDistTop([](const caf::SRProxy *sr){return std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop);})
Definition: NusVars.h:76
caf::Proxy< float > ncid
Definition: SRProxy.h:860
const std::string fnamecos_concat
const Cut kNusFD
Definition: NusCuts.h:46
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2085
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
void CutTableLoad(std::string outfile)
Definition: CutTableLoad.C:16
const Cut kNusNDFiducial([](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() > 100.0) return false;if(sr->vtx.elastic.vtx.Y()< -100.0) return false;if(sr->vtx.elastic.vtx.Y() > 100.0) return false;if(sr->vtx.elastic.vtx.Z()< 200.0) return false;if(sr->vtx.elastic.vtx.Z() > 1000.0) return false;return true;})
ND Fiducial volume from docdb 15242.
Definition: NusCuts.h:51
const Cut kNusNDPresel
Definition: NusCuts.h:69
nhit
Definition: demo1.py:25
const Cut kNusFDContain([](const caf::SRProxy *sr){const caf::SRNueCosRejProxy &cr=sr->sel.nuecosrej;if(std::min(cr.starteast, cr.stopeast)< 10) return false;if(std::min(cr.startwest, cr.stopwest)< 10) return false;if(std::min(cr.starttop, cr.stoptop) < 10) return false;if(std::min(cr.startbottom, cr.stopbottom)< 10) return false;if(std::min(cr.startfront, cr.stopfront)< 10) return false;if(std::min(cr.startback, cr.stopback)< 10) return false;return true;})
Containment variable for NC events from docdb 14241.
Definition: NusCuts.h:24
Float_t tmp
Definition: plot.C:36
void SetSpillCut(const SpillCut &cut)
const Var kEPerHit([](const caf::SRProxy *sr){if(sr->slc.nhit >0) return 1000.0 *(sr->slc.calE/sr->slc.nhit);else return-5.;})
Definition: NueVarsExtra.h:14
const Cut kNusNCSel([](const caf::SRProxy *sr){if(sr->slc.nhit >=200) return false;if(sr->slc.nhit< 20) return false;if(sr->sel.cvn.ncid< 0.2) return false;return true;})
Cut that is more CC rejection than NC selection from docdb 15285.
Definition: NusCuts.h:27
caf::Proxy< float > starttop
Definition: SRProxy.h:1030
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
caf::Proxy< caf::SRCosRej > cosrej
Definition: SRProxy.h:1208
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2077
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1221
const SpillCut kOnly14DB([](const caf::SRSpillProxy *spill){if(spill->det!=caf::kFARDET) return true;std::bitset< 14 > binary(spill->dibmask);for(int i=0;i< 14;++i){if(!binary[i]) return false;}return true;})
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2002
const std::string fnamenear_concat
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
const Var kNCP
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1271
const Binning kXYBinsFD
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
caf::Proxy< float > z
Definition: SRProxy.h:107
const Var kRemID
PID
Definition: Vars.cxx:81
const std::string fnameneardata_concat
const Binning kZBinsFD
caf::Proxy< float > x
Definition: SRProxy.h:105
caf::Proxy< caf::SRCVNResult > cvn
Definition: SRProxy.h:1209
const Var kNHit
Definition: Vars.cxx:71
const Cut kIsMuon([](const caf::SRProxy *sr){return(abs(sr->mc.nu[0].beam.ptype)==13);})
Definition: TruthCuts.h:84
const Binning kBooleanBins
Definition: NusLoadProd3.h:98
caf::StandardRecord * sr
caf::Proxy< float > partptp
Definition: SRProxy.h:1013
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:517
const HistAxis kNCAxis("Calorimetric Energy (GeV)", kNCDisappearanceEnergyBinning, kCaloE)
Axes used in Ana01 analysis by nus group.
Definition: HistAxes.h:8
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Output from Cosmic Rejection (Nuecosrej) module.
Definition: SRNueCosRej.h:10
const SystShifts kNoShift
Definition: SystShifts.cxx:21
void SaveTo(TDirectory *dir, const std::string &name) const override
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2017
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2101
Splits Data proportionally according to MC.
const Var kTuftsWeightCC
Definition: XsecTunes.h:31
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
caf::Proxy< float > y
Definition: SRProxy.h:106
caf::Proxy< float > calE
Definition: SRProxy.h:1248
std::vector< Loaders * > loaders
Definition: syst_header.h:386
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2032
const Binning kFinePIDBins
Definition: NusLoadProd3.h:102
const Cut kNusFDPresel
Definition: NusCuts.h:38
const Cut kNusCosRejMod([](const caf::SRProxy *sr){double partptp=sr->sel.nuecosrej.partptp;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return false;if(partptp >=0.8) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon==1) return false;double nhit=(double) sr->slc.nhit;if(nhit<=0.) return false;if(sr->slc.calE/nhit<=0.009) return false;return true;})
Definition: NusCuts.h:66
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Prediction that just uses FD MC, with no extrapolation.
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2100
T min(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2105
const std::string fnameswap_concat
const std::string fnamefar_concat
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:114
const Cut kNusND
Definition: NusCuts.h:71
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
FILE * outfile
Definition: dump_event.C:13
const Cut kNusCosRej([](const caf::SRProxy *sr){double numucontpid2019=sr->sel.cosrej.numucontpid2019;double partptp=sr->sel.nuecosrej.partptp;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return false;if(numucontpid2019<=0.5) return false;if(partptp >=0.8) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.lid.ismuon==1) return false;double nhit=(double) sr->slc.nhit;if(nhit<=0.) return false;if(sr->slc.calE/nhit<=0.018) return false;if(std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop)< 480) return false;return true;})
Cosmic rejection for the NC sample from docdb 15241.
Definition: NusCuts.h:33