Functions
demo0.C File Reference
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Vars/Vars.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include "TCanvas.h"
#include "TH2.h"

Go to the source code of this file.

Functions

void demo0 ()
 

Function Documentation

void demo0 ( )

Definition at line 17 of file demo0.C.

References ana::bins, plot_validation_datamc::fname, ana::SpectrumLoader::Go(), caf::Proxy< caf::SRTrackBranch >::kalman, ana::kIsNumuCC(), demo0::kTrackLen, demo0::loader, caf::Proxy< caf::SRKalman >::ntracks, pot, ana::Binning::Simple(), sr, string, caf::Proxy< caf::SRKalman >::tracks, and caf::Proxy< caf::StandardRecord >::trk.

18 {
19  // Environment variables and wildcards work. Most commonly you want a SAM
20  // dataset. Pass -ss --limit 1 on the cafe command line to make this take a
21  // reasonable amount of time for demo purposes.
22  const std::string fname = "prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
23 
24  SpectrumLoader loader(fname);
25 
26  const Binning bins = Binning::Simple(100, 0, 1000);
27 
28  // Specify variables needed and arbitrary code to extract value from
29  // SRProxy
30  const Var kTrackLen([](const caf::SRProxy* sr)
31  {
32  if(sr->trk.kalman.ntracks == 0) return 0.0f;
33  return float(sr->trk.kalman.tracks[0].len);
34  });
35 
36  // Spectrum to be filled from the loader
37  Spectrum len("Track length (cm)", bins, loader, kTrackLen, kIsNumuCC);
38 
39  // Do it!
40  loader.Go();
41 
42  // How to scale histograms
43  const double pot = 18e20;
44 
45  // We have histograms
46  len.ToTH1(pot)->Draw("hist");
47 }
const XML_Char int len
Definition: expat.h:262
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
#define pot
caf::StandardRecord * sr
const Binning bins
loader
Definition: demo0.py:10
kTrackLen
Definition: demo0.py:15
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
enum BeamMode string