test_newloader.C
Go to the documentation of this file.
2 
4 
6 
7 using namespace ana;
8 
10 
11 #include "TH1.h"
12 
14 {
15  SAMQuerySource files("prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1", -1, -1, 1);
16 
17  NewSpectrumLoader loader(&files);
18 
19  const Var kTrackLen([](const caf::SRProxy* sr)
20  {
21  if(sr->trk.kalman.ntracks == 0) return 0.0f;
22  return float(sr->trk.kalman.tracks[0].len);
23  });
24 
25  _ValExtractor<caf::SRProxy> trklenCC(kTrackLen);
26  _ValExtractor<caf::SRProxy> trklenNC(kTrackLen);
27  loader[kIsNumuCC]->Register(&trklenCC);
28  loader[kIsNC]->Register(&trklenNC);
29 
30  LabelsAndBins axis("length", Binning::Simple(100, 0, 400));
31 
32  NewSpectrum sCC(&trklenCC, axis);
33  NewSpectrum sNC(&trklenNC, axis);
34 
35  loader.Go();
36 
37  sCC.ToTH1(sCC.POT(), kRed)->Draw("hist");
38  sNC.ToTH1(sNC.POT(), kBlue)->Draw("hist same");
39 }
tree Draw("slc.nhit")
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
caf::StandardRecord * sr
File source based on a SAM query or dataset (definition)
loader
Definition: demo0.py:10
kTrackLen
Definition: demo0.py:15
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
void test_newloader()
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
enum BeamMode kBlue
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107