savePrediction_complete.C
Go to the documentation of this file.
1 #ifdef __CINT__
3  std::cout << "Sorry, you must run in compiled mode" << std::endl;
4 }
5 #else
6 
7 #include "../WorkshopIncludes.h"
8 
10 {
11  std::cout << "Drawing plots..." << std::endl;
12 
13  // Production Concats
14  std::string directoryD = "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.d/";
15  std::string directoryF = "/pnfs/nova/persistent/production/concat/R16-03-03-prod2reco.f/";
16  // Data
17  std::string nd_data = directoryD+"prod_decaf_R16-03-03-prod2reco.d_nd_numi_fhc_full_numu_contain_v1_goodruns_prod2-snapshot.root";
18 
19  // Baseline MC
20  std::string nd_nonswap = directoryD+"prod_decaf_R16-03-03-prod2reco.d_nd_genie_nonswap_genierw_f\
21 hc_nova_v08_epoch1-3c_numu_contain_v1_prod2-snapshot/*.root";
22  std::string fd_nonswap = directoryF+"/"+fEpoch+"/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonsw\
23 ap_fhc_nova_v08_"+fEpoch+"_numu_contain_v1_prod2-snapshot.root";
24  std::string fd_fluxswap = directoryF+"/"+fEpoch+"/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxs\
25 wap_fhc_nova_v08_"+fEpoch+"_numu_contain_v1_prod2-snapshot.root";
26  std::string fd_tau = directoryF+"/"+fEpoch+"/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_f\
27 hc_nova_v08_"+fEpoch+"_numu_contain_v1_prod2-snapshot.root";
28 
30  loaders.SetLoaderPath( nd_data, caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap );
31  loaders.SetLoaderPath( nd_nonswap, caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap );
32  loaders.SetLoaderPath( fd_nonswap, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap );
33  loaders.SetLoaderPath( fd_fluxswap, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
35 
37 
38  osc::OscCalculatorPMNSOpt calc;
39  ana::ResetOscCalcToDefault(&calc); // This seeds to default (in particular max-mixing)
40 
41  calc.SetTh23(TMath::ASin(sqrt(0.403))); // Second analysis best fit
42  calc.SetDmsq32(2.67e-3); // Same
43 
44  std::vector<const ISyst*> systs = getAllNumuSysts();
45 
46  TFile* f = new TFile(("../Predictions/Prediction_"+fEpoch+"_systs_kCCE.root").c_str(),"RECREATE");
47 
48  const Cut kUglyRemID(
49  {"sel.remid.pid"},
50  [](const caf::StandardRecord* sr)
51  { return (sr->sel.remid.pid > 0.25 && sr->sel.remid.pid < 0.75 );
52  }
53  );
54 
55  const Cut kBadRemID(
56  {"sel.remid.pid"},
57  [](const caf::StandardRecord* sr)
58  { return (sr->sel.remid.pid >= 0.75 && sr->sel.remid.pid < 1.0 );
59  }
60  );
61 
62  const Cut kGoodRemID(
63  {"sel.remid.pid"},
64  [](const caf::StandardRecord* sr)
65  { return (sr->sel.remid.pid == 1.0 );
66  }
67  );
68 
69  const Cut kUglyFD = kNumuQuality && kNumuContainFD && kUglyRemID && kNumuCosmicRej;
70  const Cut kBadFD = kNumuQuality && kNumuContainFD && kBadRemID && kNumuCosmicRej;
71  const Cut kGoodFD = kNumuQuality && kNumuContainFD && kGoodRemID && kNumuCosmicRej;
72 
73  const Cut kUglyND = kNumuQuality && kNumuContainND && kUglyRemID;
74  const Cut kBadND = kNumuQuality && kNumuContainND && kBadRemID ;
75  const Cut kGoodND = kNumuQuality && kNumuContainND && kGoodRemID;
76 
77  HistAxis axis( ";Reconstructed neutrino energy (GeV);Events / (0.25 GeV)", kNumuEnergyBinning, kCCE );
78 
79  NumuExtrapGenerator extrap_ugly( axis, kUglyFD, kUglyND, kNoShift, kTuftsWeightCC );
80  NumuExtrapGenerator extrap_bad ( axis, kBadFD, kBadND, kNoShift, kTuftsWeightCC );
81  NumuExtrapGenerator extrap_good( axis, kGoodFD, kGoodND, kNoShift, kTuftsWeightCC );
82 
84 
85  PredictionInterp* prediction_ugly = new PredictionInterp(systs, &calc, extrap_ugly, loaders);
86  PredictionInterp* prediction_bad = new PredictionInterp(systs, &calc, extrap_bad, loaders);
87  PredictionInterp* prediction_good = new PredictionInterp(systs, &calc, extrap_good, loaders);
88 
89  PredictionInterp* prediction_std = new PredictionInterp(systs, &calc, extrap_std, loaders);
90 
91  // GO!
92  loaders.Go();
93 
94  prediction_ugly->SaveTo(f->mkdir( "pred_ugly" ));
95  prediction_bad->SaveTo(f->mkdir( "pred_bad" ));
96  prediction_good->SaveTo(f->mkdir( "pred_good" ));
97 
98  prediction_std->SaveTo(f->mkdir( "pred_std" ));
99 
100  f->Close();
101 
102  std::cout << "Predictions saved!" << std::endl;
103 
104 } // End of function
105 
106 #endif
Near Detector underground.
Definition: SREnums.h:10
Implements systematic errors by interpolation between shifted templates.
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
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
void savePrediction_complete(std::string &fEpoch)
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
T sqrt(T number)
Definition: d0nt_math.hpp:156
const Color_t kMC
const Cut kNumuCosmicRej([](const caf::SRProxy *sr){return(sr->sel.cosrej.anglekal > 0.5 && sr->sel.cosrej.numucontpid2019 > 0.535 && sr->slc.nhit< 400);})
Definition: NumuCuts.h:32
const Cut kNumuContainFD([](const caf::SRProxy *sr){ std::pair< int, int > planes=calcFirstLastLivePlane(sr->slc.firstplane, std::bitset< 14 >(sr->hdr.dibmask));int planestofront=sr->slc.firstplane-planes.first;int planestoback=planes.second-sr->slc.lastplane;return( sr->slc.ncellsfromedge > 1 &&planestofront > 1 &&planestoback > 1 &&sr->sel.contain.kalfwdcell > 10 &&sr->sel.contain.kalbakcell > 10 &&sr->sel.contain.cosfwdcell > 0 &&sr->sel.contain.cosbakcell > 0);})
Definition: NumuCuts.h:20
const Cut kNumuFD
Definition: NumuCuts.h:53
osc::OscCalcDumb calc
const Cut kNumuContainND([](const caf::SRProxy *sr){return( sr->trk.kalman.ntracks > sr->trk.kalman.idxremid &&sr->slc.ncellsfromedge > 1 &&sr->slc.firstplane > 1 &&sr->slc.lastplane< 212 &&sr->trk.kalman.tracks[0].start.Z()< 1150 &&( sr->trk.kalman.tracks[0].stop.Z()< 1275 ||sr->sel.contain.kalyposattrans< 55) &&( sr->energy.numu.ndhadcalcatE +sr->energy.numu.ndhadcaltranE)< 0.03 &&sr->sel.contain.kalfwdcellnd > 4 &&sr->sel.contain.kalbakcellnd > 8);})
Definition: NumuCuts.h:22
Generates extrapolated Numu predictions.
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
float pid
PID value output by kNN.
Definition: SRRemid.h:25
const Binning kNumuEnergyBinning
Definition: Binnings.cxx:13
SRRemid remid
Output from RecoMuonID (ReMId) package.
Definition: SRIDBranch.h:39
const Cut kNumuND
Definition: NumuCuts.h:55
const Var kCCE
Definition: NumuVars.h:21
caf::StandardRecord * sr
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
The StandardRecord is the primary top-level object in the Common Analysis File trees.
const Var kTuftsWeightCC
Definition: XsecTunes.h:31
std::vector< Loaders * > loaders
Definition: syst_header.h:386
SRIDBranch sel
Selector (PID) branch.
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
const Cut kNumuQuality
Definition: NumuCuts.h:18
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
enum BeamMode string