get_data_histogram.C
Go to the documentation of this file.
2 #include "CAFAna/Core/Spectrum.h"
7 
8 using namespace ana;
9 
10 #include "TFile.h"
11 #include <iostream>
12 
14 {
15  /// File for making data histograms for fit
16  /// Use it for extracting OLD data hitstograms from decafs made in 2019 release
17 
18  bool getfiles=0;
19  if (getfiles){
20 
21  //std::string fnameData_rhc = "defname: prod4_sumrestricteddecaf_fd_numi_rhc_Ana2018_goodruns_nue2019";
22  //std::string fnameData_fhc = "defname: prod4_sumrestricteddecaf_fd_numi_fhc_full_goodruns_nue2018";
23  std::string fnameData_rhc = "defname: prod4_sumrestricteddecaf_fd_numi_rhc_full_goodruns_nue2019";
24  std::string fnameData_fhc = "defname: prod4_sumrestricteddecaf_fd_numi_fhc_full_goodruns_nue2019";
25 
26  SpectrumLoader loaderData_rhc(fnameData_rhc);
27  loaderData_rhc.SetSpillCut(kStandardSpillCuts);
28 
29  SpectrumLoader loaderData_fhc(fnameData_fhc);
30  loaderData_fhc.SetSpillCut(kStandardSpillCuts);
31 
34 
35  loaderData_rhc.Go();
36  loaderData_fhc.Go();
37 
38  TFile* fout = new TFile("nue_data_2019.root", "RECREATE");
39  data_rhc.SaveTo(fout, "spect_rhc");
40  data_fhc.SaveTo(fout, "spect_fhc");
41 
42  delete fout;
43  }
44 // in order to get spectra from *.root file do:
45  if (!getfiles){
46 
47  TFile * file = new TFile ("nue_data_2019.root", "READ");
48  auto data_rhc = Spectrum::LoadFrom(file, "spect_rhc");
49  auto data_fhc = Spectrum::LoadFrom(file, "spect_fhc");
50  TH1* hrhc = data_rhc->ToTH1(data_rhc->POT());
51  TH1* hfhc = data_fhc->ToTH1(data_fhc->POT());
52  cout<<" data rhc: "<<hrhc->Integral()<<" POT "<<data_rhc->POT()<<endl;
53  cout<<" data fhc: "<<hfhc->Integral()<<" POT "<<data_fhc->POT()<<endl;
54  }
55 
56 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
const HistAxis kNue2018AxisMergedPeripheral("NuE Energy / Analysis Bin", kNue2018BinningMergedPeripheral, kNue2018AnaBinMergedPeripheral)
Definition: NueCuts2018.h:181
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Cut kNue2018FDAllSamples
Definition: NueCuts2018.h:77
TFile * file
Definition: cellShifts.C:17
const Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
Definition: TimingCuts.h:8
void get_data_histogram()
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
enum BeamMode string