Classes | Functions | Variables
getTimePeak.C File Reference
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "3FlavorAna/Cuts/NumuCuts2017.h"
#include "3FlavorAna/Cuts/QuantileCuts.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/ReweightableSpectrum.h"
#include "CAFAna/Vars/Vars.h"
#include "3FlavorAna/Vars/NumuVars.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "OscLib/OscCalcPMNSOpt.h"
#include "CAFAna/Analysis/Calcs.h"
#include "CAFAna/Analysis/Plots.h"
#include "3FlavorAna/Decomp/NumuDecomp.h"
#include "CAFAna/Extrap/ModularExtrap.h"
#include "CAFAna/Extrap/ModularExtrapComponent.h"
#include "CAFAna/Prediction/PredictionCombinePeriods.h"
#include "CAFAna/Prediction/PredictionExtrap.h"
#include "CAFAna/Prediction/PredictionInterp.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "3FlavorAna/Systs/EnergySysts.h"
#include "3FlavorAna/Systs/NumuSysts.h"
#include "3FlavorAna/Vars/HistAxes.h"
#include "CAFAna/Vars/FitVars.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TGraphAsymmErrors.h"
#include "TH1.h"
#include "TH2.h"
#include "TLegend.h"
#include "TLatex.h"

Go to the source code of this file.

Classes

struct  Selection
 

Functions

void Preliminary ()
 
void Exposure ()
 
void getPredictions ()
 

Variables

const int kNumQuantiles = 4
 
const Var kSliceTimeShift ([](const caf::SRProxy *sr){const double t=sr->slc.meantime/1000;if(sr->hdr.ismc) return t;const int run=sr->hdr.run;if(run > util::kLastBadTimingRun) return t;if(!util::IsInBeamWindow(run, t *1000)) return t;if(t< 250.) return t;else return(t-64.);})
 

Function Documentation

void Exposure ( )

Definition at line 54 of file getTimePeak.C.

References caf::Proxy< caf::StandardRecord >::hdr, if(), util::IsInBeamWindow(), caf::Proxy< caf::SRHeader >::ismc, util::kLastBadTimingRun, kSliceTimeShift, caf::Proxy< caf::SRSlice >::meantime, caf::Proxy< caf::SRHeader >::run, caf::Proxy< caf::StandardRecord >::slc, sr, and confusionMatrixTree::t.

Referenced by generic.controllers.MakeCanvases.HistogramExtractor::ExtractHistsFromDirectory().

55 {
56  TLatex* ExposureLabel = new TLatex(0.55,0.80,"6.05#times10^{20} POT-equiv." );
57 
58  ExposureLabel->SetNDC();
59  ExposureLabel->SetTextSize(0.05);
60  ExposureLabel->Draw();
61 
62 }
void getPredictions ( )

Definition at line 88 of file getTimePeak.C.

References std::asin(), calc, om::cerr, om::cout, cut, update_sam_good_runs_metadata::cuts, e, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, Selection::fname, ana::Loaders::Go(), ana::kBeam, caf::kFARDET, ana::Loaders::kFluxSwap, ana::kHadEFracAxis, ana::Loaders::kMC, ana::kNoCut, ana::Loaders::kNonSwap, ana::kNoShift, ana::kNumuCCOptimisedAxis, ana::kNumuCutFD2017, ana::kPPFXFluxCVWgt, kSliceTimeShift, ana::kStandardSpillCuts, ana::Loaders::kTauSwap, ana::kXSecCVWgt2017, Selection::label, loaders, ana::pnfs2xrootd(), ana::QuantileCutsFromTH2(), ana::ResetOscCalcToDefault(), ana::SaveTo(), osc::_OscCalcPMNSOpt< T >::SetDmsq32(), ana::Loaders::SetLoaderPath(), ana::Loaders::SetSpillCut(), osc::_OscCalcPMNSOpt< T >::SetTh23(), ana::Binning::Simple(), std::sqrt(), and string.

Referenced by getTimePeakPlots().

89 {
90  std::cout << "Drawing plots..." << std::endl;
91 
92  std::string fd_dir = "/pnfs/nova/persistent/users/bzamoran/CheckEvents/";
93 
94  // std::string nd_data = "prod_sumdecaf_R17-03-01-prod3reco.d_nd_numi_fhc_period3_v1_goodruns_numu2017";
95  // std::string nd_nonswap = "prod_sumdecaf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_period3_v1_numu2017";
96  std::string fd_nonswap = fd_dir + "nonswap.root";
97  std::string fd_fluxswap = fd_dir + "fluxswap.root";
98  std::string fd_tau = fd_dir + "tau.root";
99 
102 
103  // loaders.SetLoaderPath( nd_data, caf::kNEARDET, Loaders::kData, ana::kBeam,
104  // Loaders::kNonSwap );
105  // loaders.SetLoaderPath( nd_nonswap, caf::kNEARDET, Loaders::kMC, ana::kBeam,
106  // Loaders::kNonSwap );
107  loaders.SetLoaderPath( fd_nonswap, caf::kFARDET, Loaders::kMC, ana::kBeam,
108  Loaders::kNonSwap );
109  loaders.SetLoaderPath( fd_fluxswap, caf::kFARDET, Loaders::kMC, ana::kBeam,
110  Loaders::kFluxSwap);
113 
114  gStyle->SetStatFormat("6.3g"); // Significant figures. Fix if this is not satisfactory
115  gStyle->SetPaintTextFormat("6.3g");
116  gStyle->SetFitFormat("6.3g");
117 
120  calc.SetDmsq32(2.42993e-3);
121  calc.SetTh23(asin(sqrt(0.476033))); // preliminary Ana2017
122 
123  HistAxis kAxis( "#Deltat from t_{0} (#mus)", Binning::Simple(35,25,445), kSliceTimeShift );
124 
125  // Get FD files for HadEFrac vs. neutrino energy distribution
126  std::string quantpath = "/pnfs/nova/persistent/analysis/numu/Ana2017/all_FD_histo_for_quantile_cuts.root";
127  TFile* quantfile = TFile::Open(pnfs2xrootd(quantpath).c_str());
128  TH2* quanthist = (TH2*)quantfile->Get("dir_FDSpec2D/FDSpec2D");
129  std::vector<Cut> QuantCuts = QuantileCutsFromTH2(quanthist, kNumuCCOptimisedAxis, kHadEFracAxis, 4);
130 
131  const int kNumCuts = 5;
132 
133  Selection cuts[kNumCuts] = {
134  {"Quartile 1", "Q1", QuantCuts[0]},
135  {"Quartile 2", "Q2", QuantCuts[1]},
136  {"Quartile 3", "Q3", QuantCuts[2]},
137  {"Quartile 4", "Q4", QuantCuts[3]},
138  {"All quartiles", "AllQ", kNoCut}
139  };
140 
141  // make a vector with an entry for each quantiles
142  // std::vector<NumuExtrapGenerator*> NumuCCExtrapVec;
143  // std::vector<PredictionInterp*> predictionVec;
144  std::vector<PredictionNoExtrap*> predictionVec;
145 
146  for(int k = 0; k < kNumCuts; k++)
147  {
148  // NumuCCExtrapVec.push_back(new NumuExtrapGenerator(kAxis, cuts[k].cut && kNumuCutFD2017, cuts[k].cut && kNumuCutND2017, kNoShift, kPPFXFluxCVWgt * kXSecCVWgt2017));
149  // predictionVec.push_back(new PredictionInterp({}, &calc, *(NumuCCExtrapVec.back()), loaders));
150  predictionVec.push_back( new PredictionNoExtrap(loaders, kAxis, kNumuCutFD2017 && cuts[k].cut, kNoShift, kPPFXFluxCVWgt * kXSecCVWgt2017) );
151 
152  } // loop over quantiles
153 
154  loaders.Go();
155 
156  std::string OutFileName = "";
157  // save predictions for later
158  for(int k = 0; k < kNumCuts; k++)
159  {
160  auto prediction = predictionVec[k];
161  OutFileName = "Predictions/pred_" + cuts[k].fname + ".root";
162  std::cerr << "Saving cut " << (cuts[k].label).c_str() << " to file: " << OutFileName << std::endl;
163  TFile *f = TFile::Open(OutFileName.c_str(), "RECREATE");
164  prediction -> SaveTo(f, "prediction");
165  f->Close();
166  delete f;
167  }
168 
169  // now actually do the plots!
170 
171  std::cout << "All plots finished!" << std::endl;
172 
173 
174 } // End of function
Far Detector at Ash River.
Definition: SREnums.h:11
void ResetOscCalcToDefault(osc::IOscCalcAdjustable *calc)
Reset calculator to default assumptions for all parameters.
Definition: Calcs.cxx:23
void SaveTo(const osc::IOscCalc &x, TDirectory *dir, const std::string &name)
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Cut kNumuCutFD2017
Definition: NumuCuts2017.h:39
std::string fname
Definition: getTimePeak.C:84
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
T sqrt(T number)
Definition: d0nt_math.hpp:156
const HistAxis kHadEFracAxis("E_{had.} / E_{#nu}", Binning::Simple(200, 0, 1), kHadEFrac)
HistAxis that implements Hadronic Energy fraction binning used by L.Vinton to derive Hadronic Energy ...
Definition: HistAxes.h:30
const Color_t kMC
OStream cerr
Definition: OStream.cxx:7
std::string pnfs2xrootd(std::string loc, bool unauth)
Definition: UtilsExt.cxx:237
osc::OscCalcDumb calc
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const Var kSliceTimeShift([](const caf::SRProxy *sr){const double t=sr->slc.meantime/1000;if(sr->hdr.ismc) return t;const int run=sr->hdr.run;if(run > util::kLastBadTimingRun) return t;if(!util::IsInBeamWindow(run, t *1000)) return t;if(t< 250.) return t;else return(t-64.);})
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
std::string label
Definition: getTimePeak.C:83
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:31
void SetTh23(const T &th23) override
const HistAxis kNumuCCOptimisedAxis("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kCCE)
HistAxis that implements optimised numuCCE from L. Vinton. See docdb 16332. This was close to &#39;custC&#39;...
Definition: HistAxes.h:24
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
void SetDmsq32(const T &dmsq32) override
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
std::vector< Cut > QuantileCutsFromTH2(TH2 *quantileHist, const HistAxis &independentAxis, const HistAxis &quantileAxis, const unsigned int &numQuantiles, const bool verbose)
: Do the same as the QuantileCuts function but taking in the TH2 instead of making it...
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Prediction that just uses FD MC, with no extrapolation.
const Var kXSecCVWgt2017
Definition: XsecTunes.h:36
Float_t e
Definition: plot.C:35
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
T asin(T number)
Definition: d0nt_math.hpp:60
enum BeamMode string
void Preliminary ( )

Definition at line 44 of file getTimePeak.C.

References kBlue, and prelim.

45 {
46  TLatex* prelim = new TLatex(.9, .95, "NOvA Preliminary");
47  prelim->SetTextColor(kBlue);
48  prelim->SetNDC();
49  prelim->SetTextSize(2/30.);
50  prelim->SetTextAlign(32);
51  prelim->Draw();
52 }
TLatex * prelim
Definition: Xsec_final.C:133
enum BeamMode kBlue

Variable Documentation

const int kNumQuantiles = 4

Definition at line 42 of file getTimePeak.C.

const Var kSliceTimeShift([](const caf::SRProxy *sr){const double t=sr->slc.meantime/1000;if(sr->hdr.ismc) return t;const int run=sr->hdr.run;if(run > util::kLastBadTimingRun) return t;if(!util::IsInBeamWindow(run, t *1000)) return t;if(t< 250.) return t;else return(t-64.);})

Referenced by Exposure(), and getPredictions().