test_sam.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Binning.h"
3 #include "CAFAna/Core/Spectrum.h"
4 #include "CAFAna/Vars/Vars.h"
5 
6 #include "TH1.h"
7 
8 using namespace ana;
9 
10 void test_sam()
11 {
12  // Can use a dataset name
13  SpectrumLoader loader("prod_caf_S14-07-11_fardet_cosmics_p1_7db_good");
14 
15  // Or a query
16  // SpectrumLoader loader("data_tier caf and caf.base_release S14-07-11 and pid.base_release S14-05-12 and pidpart.base_release S14-05-12 and reconstructed.base_release S14-05-08 and online.detector fardet and online.stream 2 and online.partition 1 and online.runnumber >= 14702 and online.runnumber < 14802 and dq.isgoodrun true");
17 
18  // Everything else is the same
19 
20  Spectrum spect("Calorimetric Energy (GeV)", Binning::Simple(40, 0, 10), loader, kCaloE, kNoCut);
21 
22  loader.Go();
23 
24  spect.ToTH1(spect.POT())->Draw("hist");
25 }
26 
tree Draw("slc.nhit")
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
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:176
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
const Var kCaloE
Summed calorimetric energy of all hits in slice, uncorrected.
Definition: Vars.cxx:52
virtual void Go() override
Load all the registered spectra.
loader
Definition: demo0.py:10
double POT() const
Definition: Spectrum.h:226
void test_sam()
Definition: test_sam.C:10
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNoCut
Definition: Cut.h:13