SpectrumLoaderNuTreeSpillCuts.cxx
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 
7 std::ostream& operator<<(std::ostream& os,
9 {
10  os << "(" << key.run << ", " << key.subrun << ", " << key.evt << ")";
11  return os;
12 }
13 
14 namespace ana
15 {
17  {
18  public:
20 
21  bool operator()(const caf::SRNeutrinoProxy* nu) const
22  {
23  // Look up each nu in the map that the loader has already accumulated
24 
25  const SpectrumLoaderNuTreeSpillCuts::Key_t key = {nu->run, nu->subrun, nu->evt};
26  const auto it = fLoader->fIsSpillGood.find(key);
27 
28  if(it == fLoader->fIsSpillGood.end()){
29  std::cout << "SpectrumLoaderNuTreeSpillCuts: unknown event "
30  << key << std::endl;
31  abort();
32  }
33 
34  return it->second;
35  }
36 
37  protected:
39  };
40 
41  // --------------------------------------------------------------------------
44  {
45  // We hijack AccumulateExposures so that we can see each spill in the file
46  // and record whether it passes spill cuts or not.
47  const Key_t key = {spill->run, spill->subrun, spill->evt};
48 
49  if(fIsSpillGood.count(key)){
50  std::cout << "SpectrumLoaderNuTreeSpillCuts: event "
51  << key << " seen twice."
52  << std::endl;
53  abort();
54  }
55 
56  fIsSpillGood.emplace(key, fSpillCut ? (*fSpillCut)(spill) : true);
57 
58  // Then carry on with the actual POT accounting
60  }
61 
62  //----------------------------------------------------------------------
65  const NuTruthVar& var,
66  const NuTruthCut& cut,
67  const SystShifts& shift,
68  const NuTruthVar& wei)
69  {
70  // Forward to the base class, but including our additional spill cut
72  cut && NuTruthCut(NuTruthSpillCut(this)),
73  shift, wei);
74  }
75 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
set< int >::iterator it
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
void AccumulateExposures(const caf::SRSpillProxy *spill) override
virtual void AddSpectrum(Spectrum &spect, const Var &var, const Cut &cut, const SystShifts &shift, const Var &wei=kUnweighted)
For use by the Spectrum constructor.
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
void AccumulateExposures(const caf::SRSpillProxy *spill) override
_Cut< caf::SRNeutrinoProxy > NuTruthCut
Cut designed to be used over the nuTree, ie all neutrinos, not just those that got slices...
Definition: Cut.h:104
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
bool operator()(const caf::SRNeutrinoProxy *nu) const
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:1367
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:527
loader
Definition: demo0.py:10
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:1410
Proxy for caf::SRSpill.
Definition: SRProxy.h:1346
OStream cout
Definition: OStream.cxx:6
const Cut cut
Definition: exporter_fd.C:30
caf::Proxy< unsigned int > run
Definition: SRProxy.h:1406
const SpectrumLoaderNuTreeSpillCuts * fLoader
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:561
caf::Proxy< unsigned int > run
Definition: SRProxy.h:559
Template for Cut and SpillCut.
Definition: Cut.h:15
Template for Var and SpillVar.
void AddSpectrum(Spectrum &spect, const NuTruthVar &var, const NuTruthCut &cut, const SystShifts &shift, const NuTruthVar &wei=kNuTruthUnweighted) override
For use by the Spectrum constructor.
NuTruthSpillCut(const SpectrumLoaderNuTreeSpillCuts *loader)