Functions
get_data_histogram.C File Reference
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "3FlavorAna/Cuts/NueCuts2018.h"
#include "CAFAna/Analysis/Exposures.h"
#include "TFile.h"
#include <iostream>

Go to the source code of this file.

Functions

void get_data_histogram ()
 

Function Documentation

void get_data_histogram ( )

File for making data histograms for fit Use it for extracting OLD data hitstograms from decafs made in 2019 release

Definition at line 13 of file get_data_histogram.C.

References om::cout, allTimeWatchdog::endl, file, submit_syst::fout, ana::SpectrumLoader::Go(), ana::kInBeamSpill, ana::kNoShift, ana::kNue2018AxisMergedPeripheral, ana::kNue2018FDAllSamples, ana::kStandardSpillCuts, ana::Spectrum::LoadFrom(), ana::Spectrum::SaveTo(), ana::SpectrumLoaderBase::SetSpillCut(), and string.

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 }
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const HistAxis kNue2018AxisMergedPeripheral("NuE Energy / Analysis Bin", kNue2018BinningMergedPeripheral, kNue2018AnaBinMergedPeripheral)
Definition: NueCuts2018.h:181
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
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
enum BeamMode string