savePrediction_extrap.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  // Only one of the files. In true life, use all MC!
21  std::string nd_nonswap_few = directoryD+"prod_decaf_R16-03-03-prod2reco.d_nd_genie_nonswap_genierw_fhc_nova_v08_epoch1-3c_numu_contain_v1_prod2-snapshot/*_1_of_16.root";
22  // Epoch 3b only for FD to run quickly. In practice, use a PredictionCombinePeriods
23  std::string fd_nonswap_3b = directoryF+"/epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_epoch3b_numu_contain_v1_prod2-snapshot.root";
24  std::string fd_fluxswap_3b = directoryF+"/epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_fluxswap_fhc_nova_v08_epoch3b_numu_contain_v1_prod2-snapshot.root";
25  std::string fd_tau_3b = directoryF+"/epoch3b/prod_decaf_R16-03-03-prod2reco.f_fd_genie_tau_fhc_nova_v08_epoch3b_numu_contain_v1_prod2-snapshot.root";
26 
28  loaders.SetLoaderPath( nd_data, caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap );
29  loaders.SetLoaderPath( nd_nonswap_few, caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap );
30  loaders.SetLoaderPath( fd_nonswap_3b, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap );
31  loaders.SetLoaderPath( fd_fluxswap_3b, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
33 
35 
36  osc::OscCalculatorPMNSOpt calc;
37  ana::ResetOscCalcToDefault(&calc); // This seeds to default (in particular max-mixing)
38 
39  calc.SetTh23(TMath::ASin(sqrt(0.403))); // Second analysis best fit
40  calc.SetDmsq32(2.67e-3); // Same
41 
42  TFile* f = new TFile("../Predictions/Prediction_epoch3b_extrap_kCCE.root","RECREATE"); // different name
43 
44  const Cut kUglyRemID(
45  {"sel.remid.pid"},
46  [](const caf::StandardRecord* sr)
47  { return (sr->sel.remid.pid > 0.25 && sr->sel.remid.pid < 0.75 );
48  }
49  );
50 
51  const Cut kBadRemID(
52  {"sel.remid.pid"},
53  [](const caf::StandardRecord* sr)
54  { return (sr->sel.remid.pid >= 0.75 && sr->sel.remid.pid < 1.0 );
55  }
56  );
57 
58  const Cut kGoodRemID(
59  {"sel.remid.pid"},
60  [](const caf::StandardRecord* sr)
61  { return (sr->sel.remid.pid == 1.0 );
62  }
63  );
64 
65  const Cut kUglyFD = kNumuQuality && kNumuContainFD && kUglyRemID && kNumuCosmicRej;
66  const Cut kBadFD = kNumuQuality && kNumuContainFD && kBadRemID && kNumuCosmicRej;
67  const Cut kGoodFD = kNumuQuality && kNumuContainFD && kGoodRemID && kNumuCosmicRej;
68 
69  const Cut kUglyND = kNumuQuality && kNumuContainND && kUglyRemID;
70  const Cut kBadND = kNumuQuality && kNumuContainND && kBadRemID ;
71  const Cut kGoodND = kNumuQuality && kNumuContainND && kGoodRemID;
72 
73  HistAxis axis( ";Reconstructed neutrino energy (GeV);Events / (0.25 GeV)", kNumuEnergyBinning, kCCE );
74 
75  NumuExtrapGenerator extrap_ugly( axis, kUglyFD, kUglyND, kNoShift, kTuftsWeightCC );
76  NumuExtrapGenerator extrap_bad ( axis, kBadFD, kBadND, kNoShift, kTuftsWeightCC );
77  NumuExtrapGenerator extrap_good( axis, kGoodFD, kGoodND, kNoShift, kTuftsWeightCC );
78 
80 
81  PredictionInterp* prediction_ugly = new PredictionInterp({}, &calc, extrap_ugly, loaders);
82  PredictionInterp* prediction_bad = new PredictionInterp({}, &calc, extrap_bad, loaders);
83  PredictionInterp* prediction_good = new PredictionInterp({}, &calc, extrap_good, loaders);
84 
85  PredictionInterp* prediction_std = new PredictionInterp({}, &calc, extrap_std, loaders);
86 
87  // GO!
88  loaders.Go();
89 
90  prediction_ugly->SaveTo(f->mkdir( "pred_ugly" ));
91  prediction_bad->SaveTo(f->mkdir( "pred_bad" ));
92  prediction_good->SaveTo(f->mkdir( "pred_good" ));
93 
94  prediction_std->SaveTo(f->mkdir( "pred_std" ));
95 
96  f->Close();
97 
98  std::cout << "Predictions saved!" << std::endl;
99 
100 } // End of function
101 
102 #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
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:21
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
void savePrediction_extrap()
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