Functions
DrawCovMx.C File Reference
#include "NuXAna/Core/Utilities.h"
#include "NuXAna/Systs/NusAna2020Systs.h"
#include "NuXAna/macros/Nus20/Utilities.h"
#include "TCanvas.h"

Go to the source code of this file.

Functions

void DrawCovMx ()
 

Function Documentation

void DrawCovMx ( )

Definition at line 16 of file DrawCovMx.C.

References plot_validation_datamc::c, calc, om::cout, ana::DefaultSterileCalc(), e, allTimeWatchdog::endl, ana::getNusAna2020AllSysts(), GetSamplesFromOptString(), MECModelEnuComparisons::i, inFile, ana::InputPath(), MECModelEnuComparisons::opt, runNovaSAM::release, SetEverything(), SetNus20Params(), systs, and getGoodRuns4SAM::tag.

16  {
17 
18  try {
19 
20  DontAddDirectory guard;
21 
22  string opt = "numusel_ncsel_fhc_neardet_fardet";
23 
24  TFile* plotFile = TFile::Open(("plots/covmx/plots_"+opt+".root").c_str(), "recreate");
25  TDirectory* systDir = plotFile->mkdir("systs");
26 
27  vector<Sample> samples = GetSamplesFromOptString(opt.c_str());
28  for (Sample& s : samples) SetEverything(s);
29  vector<const ISyst*> systs = getNusAna2020AllSysts();
30  auto calc = DefaultSterileCalc(4);
32  ostringstream tag;
33  for (size_t i = 0; i < samples.size(); ++i) {
34  if (i > 0) tag << "_";
35  tag << samples[i].GetID();
36  }
37  TCanvas c("c", "c", 1600, 900);
38  TFile* inFile = TFile::Open((InputPath()+"/covmx/mx.root").c_str(), "read");
39  CovarianceMatrix* mx = LoadFrom<CovarianceMatrix>(inFile, tag.str()+"/allsysts").release();
40  TH2* hMx = mx->GetCovMxRelativeTH2(samples, calc);
41  plotFile->WriteTObject(hMx, "MxScaled");
42  hMx->Draw("colz");
43  c.SaveAs("plots/covmx/MxScaled.png");
44  delete hMx;
45  hMx = mx->GetFullCovMxTH2();
46  plotFile->WriteTObject(hMx, "MxFull");
47  hMx->Draw("colz");
48  c.SaveAs("plots/covmx/MxFull.png");
49  delete hMx;
50  hMx = mx->GetFullCorrMxTH2();
51  plotFile->WriteTObject(hMx, "MxCorrFull");
52  hMx->Draw("colz");
53  c.SaveAs("plots/covmx/MxFullCorr.png");
54  delete hMx;
55 
56  } catch(const exception& e) {
57  cout << endl << "Exception occurred! " << e.what() << endl;
58  }
59 
60 }
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
void SetNus20Params(osc::OscCalcSterile *calc, std::string type="3flav")
Definition: Utilities.h:621
void SetEverything(covmx::Sample &sample, bool systs=false, double res=0)
Definition: Utilities.h:527
vector< const ISyst * > getNusAna2020AllSysts(covmx::Sample &s)
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
osc::OscCalcDumb calc
ifstream inFile
Definition: AnaPlotMaker.h:34
const XML_Char * s
Definition: expat.h:262
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
OStream cout
Definition: OStream.cxx:6
string InputPath()
Definition: Utilities.cxx:12
std::vector< covmx::Sample > GetSamplesFromOptString(TString optString)
Function to take an option TString and return a vector of associated covmx::Samples.
Definition: Utilities.h:373
Prevent histograms being added to the current directory.
Definition: UtilsExt.h:46
Float_t e
Definition: plot.C:35