genie_syst_universe.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Spectrum.h"
3 #include "CAFAna/Systs/Systs.h"
4 #include "CAFAna/Systs/JointAna2018Systs.h"
11 
12 #include "TFile.h"
13 #include "TCanvas.h"
14 #include "TPad.h"
15 #include "TLatex.h"
16 #include "TStyle.h"
17 
18 #include <iostream>
19 
20 using namespace ana;
21 
23 {
24  auto allsysts = getAna2018SmallXsecSystsForPCA();
25  const int totalsysts = allsysts.size();
26  const int nuniverses = 1000;
27 
28  std::vector <std::pair <const ISyst*, SystMode> > systConfigs;
29  for (int idx = 0; idx < totalsysts; ++idx)
30  systConfigs.push_back({allsysts[idx], kSystGaussian});
31 
32  auto shifts = GetSystShiftsMultiverse(systConfigs, nuniverses);
33 
34  TH2D* h = new TH2D("h",";;Shift",totalsysts,0,totalsysts,30,-3,3);
35 
36  std::cout<<totalsysts<<std::endl;
37 
38  //for(int i = 0;i < nuniverses;++i){
39  for(int i = 0;i < 1;++i){
40  for(int j = 0;j < totalsysts;++j){
41  h->Fill(j,shifts[i].GetShift(systConfigs[j].first));
42  }
43  }
44 
45  TCanvas *c = new TCanvas("c","c");
46 
47  c->SetBottomMargin(0.4);
48 
49  h->GetYaxis()->CenterTitle();
50  h->GetXaxis()->SetLabelSize(0);
51 
52  gStyle->SetPalette(kCool);
53 
54  h->Draw("colz");
55 
56  std::vector<std::string> labels;
57  for(int i = 0;i < totalsysts;++i){
58  labels.push_back(systConfigs[i].first->LatexName());
59  }
60 
61  double left = gPad->GetLeftMargin();
62  double right = 1-gPad->GetRightMargin();
63  double top = 1-gPad->GetTopMargin();
64  double bottom = gPad->GetBottomMargin();
65 
66  TLatex *tLabel = new TLatex();
67  tLabel->SetTextAlign(12);
68  tLabel->SetTextSize(0.018);
69  tLabel->SetNDC();
70  tLabel->SetTextAngle(-90);
71 
72  double center=0;
73  for(unsigned int i = 0;i < labels.size();++i){
74  center = left+(right-left)*(1+2*i)/(labels.size()*2);
75  tLabel->DrawLatex(center, 0.95*bottom, labels[i].c_str());
76  }
77 
78  c->Print("plots/genie_universe_single.pdf");
79 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void genie_syst_universe()
SystShifts GetShift(TString systName, double sigma)
const double j
Definition: BetheBloch.cxx:29
std::vector< SystShifts > GetSystShiftsMultiverse(const std::vector< std::pair< const ISyst *, SystMode > > &systConfigs, const int nUniverses, const int seed)
Definition: SystShifts.cxx:283
OStream cout
Definition: OStream.cxx:6
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
const int nuniverses
TGeoVolume * top
Definition: make_fe_box.C:9