AnalyseBinningSchemes.C
Go to the documentation of this file.
1 
4 
5 #include "TCanvas.h"
6 #include "TFile.h"
7 #include "TH2.h"
8 
9 using namespace ana;
10 using std::cout;
11 using std::endl;
12 using std::string;
13 
15 
16  try {
17 
18  TH2D h("h", "h", 6, 0, 6, 6, 0, 6);
19 
20  for (int i = 1; i < 7; ++i) {
21  for (int j = 1; j < 7; ++j) {
22  ostringstream filename;
23  filename << "/nova/data/users/ohhu/BinningStudy/nd" << i << "_fd" << j << ".root";
24  TFile* f = TFile::Open(filename.str().c_str(), "read");
25  TH2* surf = LoadFrom<CovMxSurface>(f)->GetSurface();
26  double counter = 0;
27  for (int x = 1; x <= surf->GetNbinsX(); ++x) { // loop over x bins
28  for (int y = 1; y <= surf->GetNbinsY(); ++y) { // now loop int y over Y bins in the same way
29  double chisq = surf->GetBinContent(x, y);
30  double up_value = TMath::ChisquareQuantile(0.9, 1);
31  if (chisq > up_value) {
32  ++counter;}
33  else continue;
34  } // for y
35  } // for x
36  double ratio = (counter / 2500);
37  h.SetBinContent(i, j, ratio);
38  } // for j
39  } // for i
40 
41  // Now we can draw the output
42  TCanvas c("c", "c", 1700, 900);
43  h.Draw("colz");
44  c.SaveAs("test.pdf");
45 
46  } catch(const exception& e) {
47  cout << endl << "Exception occurred! " << e.what() << endl;
48  }
49 
50 }
51 
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
TH1 * ratio(TH1 *h1, TH1 *h2)
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
string filename
Definition: shutoffs.py:106
void AnalyseBinningSchemes()
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
Float_t e
Definition: plot.C:35
surf
Definition: demo5.py:35
enum BeamMode string