joint_fit_2020_datarelease_tools.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //mini toolset to format official data release files
3 ////////////////////////////////////////////////////////////////////////////////
4 
5 #pragma once
6 
7 #include "TFile.h"
8 #include "TString.h"
9 #include "TH2F.h"
10 #include "TMarker.h"
11 #include "TGraph.h"
12 
13 #include <vector>
14 #include <string>
15 #include <iostream>
16 
17 TFile * MakeDataReleaseFileContour (TString preffix, bool dmsqSurf)
18 {
19  TString filename = (preffix +
20  "NOvA_2020_official_contour_" +
21  (dmsqSurf? "ssth23dmsq32":"deltassth23" ) +
22  ".root");
23  std::cout << "\nCreating official release file "
24  << filename << std::endl << std::endl;
25 
26  auto ret = new TFile(filename, "recreate");
27 
28  if(dmsqSurf) {
29  auto axes_NH =
30  new TH2F("NH_axes",
31  ";sin^{2}#theta_{23};#Deltam^{2}_{32} (10^{-3}eV^{2}/c^{4})",
32  100,0.3,0.7,100,2.05,2.85);
33  auto axes_IH =
34  new TH2F("IH_axes",
35  ";sin^{2}#theta_{23};#Deltam^{2}_{32} (10^{-3}eV^{2}/c^{4})",
36  100,0.3,0.7,100,-2.95,-2.15);
37  axes_NH->Write();
38  axes_IH->Write();
39  }
40  else{
41  TH2* axes = new TH2F("axes",
42  ";#delta_{CP}/#pi;sin^{2}#theta_{23}",
43  100,0,2,100,0.275,0.725);
44  axes->Write();
45  }
46  return ret;
47 }
48 
49 TFile * MakeDataReleaseFileSlice (TString preffix, bool th23Slice, bool dmsqSlice)
50 {
51  TString filename = (preffix +
52  "NOvA_2020_official_slice_" +
53  (th23Slice ? "ssth23" :
54  (dmsqSlice? "dmsq32":"delta" )) +
55  ".root");
56  std::cout << "\nCreating official release file "
57  << filename << std::endl << std::endl;
58 
59  auto ret = new TFile(filename, "recreate");
60  TH2F* axes;
61 
62  if(th23Slice) {
63  axes = new TH2F("axes",";sin^{2}#theta_{23};Significance (#sigma)",
64  100,0.32,0.72,100,0,3);
65  }
66  else if (dmsqSlice) {
67  axes = new TH2F("axes",
68  ";|#Deltam^{2}_{32}| (10^{-3} eV^{2}/c^{4});Significance (#sigma)",
69  100,2.15,2.75,100,0,3);
70  }
71  else {
72  axes = new TH2F("axes",";#delta_{CP}/#pi;Significance (#sigma)",
73  100,0,2,100,0,5);
74 
75  }
76 
77  axes->Write();
78 
79  return ret;
80 }
81 
83  std::vector <TGraph*> graphs,
84  TString label,
85  TString hiestr)
86 {
87  auto tempdir = gDirectory;
88  file->cd();
89  int ngraphs = graphs.size();
90  for(int i = 0; i < ngraphs; ++i){
91  TString name = hiestr + "_" + label;
92  if(ngraphs>1) name += ("_" + std::to_string(i));
93  graphs[i]->Write(name);
94  std::cout << "Official: Added graph " << name << "\n";
95  }
96  tempdir->cd();
97 }
98 
100  std::vector < std::pair <TGraph*, TString> > graphs)
101 {
102  auto tempdir = gDirectory;
103  file->cd();
104  for (auto const & gr:graphs) {
105  gr.first->ResetAttLine();
106  gr.first->Write(gr.second);
107  std::cout << "Official: Added graph " << gr.second << "\n";
108  }
109 }
110 
112  TMarker & bf,
113  TString label,
114  TString hiestr)
115 {
116  auto tempdir = gDirectory;
117  file->cd();
118  bf.SetMarkerStyle(kFullCircle);
119  bf.SetMarkerSize(1);
120  TString name = hiestr + "_" + label;
121  bf.Write(name);
122  std::cout << "Official: Added marker " << name << "\n";
123  tempdir->cd();
124 }
125 
126 
const XML_Char * name
Definition: expat.h:151
TFile * MakeDataReleaseFileContour(TString preffix, bool dmsqSurf)
string filename
Definition: shutoffs.py:106
const char * label
void GraphsToDataRelease(TFile *file, std::vector< TGraph * > graphs, TString label, TString hiestr)
OStream cout
Definition: OStream.cxx:6
void BestFitToDataRelease(TFile *file, TMarker &bf, TString label, TString hiestr)
TFile * MakeDataReleaseFileSlice(TString preffix, bool th23Slice, bool dmsqSlice)
TFile * file
Definition: cellShifts.C:17
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32