nus17_fiducial_mass.C
Go to the documentation of this file.
1 #include "TFile.h"
2 #include "TF1.h"
3 #include "TH1.h"
4 #include "TEfficiency.h"
5 #include "TCanvas.h"
6 #include "TF1.h"
7 
9 {
10  TH1::SetDefaultSumw2();
11 
12  TFile* fileIn = new TFile(input.c_str(), "READ");
13 
14  TH1D* hSigEffFull = new TH1D("hSigEff_FidMass","Nus17 NC Selection Efficiency;Diblocks;Efficiency",11,3.5,14.5);
15  TH1D* hSigEffIdeal = new TH1D("hSigEff_SmallWindow","Nus17 NC Selection Efficiency;Diblocks;efficiency",11,3.5,14.5);
16 
17  TH1D* hNFull = (TH1D*)fileIn->Get("hN_FidMass");
18  TH1D* hDFull = (TH1D*)fileIn->Get("hD_FidMass");
19  TH1D* hNIdeal = (TH1D*)fileIn->Get("hN_SmallWindow");
20  TH1D* hDIdeal = (TH1D*)fileIn->Get("hD_SmallWindow");
21 
22  hSigEffFull->Divide(hNFull, hDFull, 1.0, 1.0, "b");
23  hSigEffIdeal->Divide(hNIdeal, hDIdeal, 1.0, 1.0, "b");
24 
25 
26  TF1 *asymptote = new TF1("asymptote", "[0] + [1]/(0.993*x)", 0., 1.);
27  asymptote->SetParameter(0, 1);
28  asymptote->SetParameter(1, 1);
29 
30  TCanvas *c0 = new TCanvas("c0", "c0", 200, 10, 800, 600);
31  c0->cd();
32  hSigEffFull->Fit("asymptote");
33  hSigEffFull->Draw();
34  asymptote->Draw("same");
35  c0->Update();
36  c0->Print("Efficiency_vs_Diblocks.pdf");
37 
38  double a = asymptote->GetParameter(0);
39  double del_a = asymptote->GetParError(0);
40  double b = asymptote->GetParameter(1);
41  double del_b = asymptote->GetParError(1);
42 
43 
44  double ideal_eff = hSigEffIdeal->GetBinContent(11);
45 
46  std::cout << "Fiducial mass tables : " << std::endl;
47  std::cout << "=======================" << std::endl;
48  for(int i = 1; i <= hSigEffFull->GetNbinsX(); i++){
49  double m_f = ((i+3)*0.993/ideal_eff)*(a+(b/((i+3)*0.993)));
50 
51  std::cout << "N_diblock : " << i+3 << ", Fiducial Mass : " << m_f << ", Efficiency : " << hSigEffFull->GetBinContent(i) << std::endl;
52  }
53 
54  std::cout << "=======================" << std::endl;
55  std::cout << "Ideal Efficiency : " << ideal_eff << std::endl;
56 
57 }
const double a
OStream cout
Definition: OStream.cxx:6
const hit & b
Definition: hits.cxx:21
void nus17_fiducial_mass(std::string input)
enum BeamMode string