test_systmultiverse.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Spectrum.h"
6 #include "CAFAna/Systs/Systs.h"
11 
12 
13 #include "TCanvas.h"
14 #include "TFile.h"
15 
16 #include <iostream>
17 
18 using namespace ana;
19 
20 
22 {
23 
24  const int nUniverses = 10;
25 
26  auto multiverse_shifts = GetSystShiftsMultiverse({
27  {kMAQAGenieReducedSyst2017, SystMode::kSystGaussian},
28  {GetGenieKnobSyst(rwgt::fReweightCCQEPauliSupViaKF), ana::kSystInteger},
32  }, nUniverses);
33 
34  std::cout << "Created " << multiverse_shifts.size() << " universes:" << std::endl;
35 
36  assert (nUniverses == multiverse_shifts.size());
37 
38  for (int uniIdx = 0; uniIdx < nUniverses; ++uniIdx) {
39  std::cout << std::endl << "Universe " << uniIdx << std::endl;
40  auto systs = multiverse_shifts[uniIdx].ActiveSysts();
41 
42  for (uint sysIdx = 0; sysIdx < systs.size(); ++sysIdx) {
43  std::cout << " ISyst " << systs[sysIdx]->LatexName()
44  << " shift " << multiverse_shifts[uniIdx].GetShift(systs[sysIdx])
45  << std::endl;
46  }//end systs
47  }//end universes
48 
49  SpectrumLoader loader ("dataset_def_name_newest_snapshot prod_decaf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1 with limit 5");
50  std::vector <CheatDecomp *> decomps;
52  for (auto shift: multiverse_shifts){
53  decomps.push_back(new CheatDecomp(loader, kNumuCCAxis, cut, shift));
54  }
55  decomps.push_back(new CheatDecomp(loader, kNumuCCAxis, cut, kNoShift));
56 
57 
58  loader.Go();
59 
60  double pot = 1E18;
61  auto hnom = decomps[nUniverses]->TotalMC().ToTH1(pot,kRed,9);
62  hnom->SetMaximum(1.4*hnom->GetMaximum());
63  hnom->SetLineWidth(4);
64  hnom->Draw("hist");
65  for (int idx=0; idx < nUniverses; ++idx){
66  int color = (idx%3 == 1 ? 2+idx%8 : kGray);
67  decomps[idx]->TotalMC().ToTH1(pot,color)->Draw("hist same");
68  decomps[idx]->NCTotalComponent().ToTH1(pot,color)->Draw("hist same");
69  }
70  hnom->Draw("hist same");
71  auto hnc = decomps[nUniverses]->NCTotalComponent().ToTH1(pot,kAzure,9);
72  hnc->SetLineWidth(4);
73  hnc->Draw("hist same");
74  gPad->Print("test_multiverse.pdf");
75 
76 }
BeamSyst * GetPPFXPrincipals(int PCIdx)
Definition: BeamSysts.cxx:65
void test_systmultiverse()
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
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
const NormSyst kNormSyst
Definition: Systs.cxx:14
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Definition: HistAxes.h:8
#define pot
const BeamSyst kBeamAllTransport((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"totErr","beamTransportComb","Combined Beam Transport Systematics")
All Beam Transport systematics combined in quadratures.
Definition: BeamSysts.h:131
virtual void Go() override
Load all the registered spectra.
std::vector< SystShifts > GetSystShiftsMultiverse(const std::vector< std::pair< const ISyst *, SystMode > > &systConfigs, const int nUniverses, const int seed)
Definition: SystShifts.cxx:283
loader
Definition: demo0.py:10
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
const Cut cut
Definition: exporter_fd.C:30
const Cut kNumuBasicQuality([](const caf::SRProxy *sr){return(sr->energy.numu.trkccE > 0 && sr->sel.remid.pid > 0 && sr->slc.nhit > 20 && sr->slc.ncontplanes > 4 && sr->trk.cosmic.ntracks > 0);})
Definition: NumuCuts.h:14
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
assert(nhit_max >=nhit_nbins)
const NOvARwgtSyst * GetGenieKnobSyst(rwgt::ReweightLabel_t knobIdx, std::string altName, std::string altLabel)
Convenience function to get a GENIE knob syst. (Allows using the GENIE knob name & description as the...
Definition: XSecSysts.cxx:119
Just return the ND truth spectra as the decomposition.
Definition: CheatDecomp.h:10
unsigned int uint