efficiencycalc.C
Go to the documentation of this file.
2 {
3 
4  ///Scale by a factor of 10.6665528901////From raw histogram in root file at 3.54e21 actual POT and 8e20 scaled////
5  TFile *f1= new TFile ("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/new2pngvariable_alternate_03GeV_Cuts_1CVN_07_2CVN_08_WITHDATA_genielike.root","READ");
6  TH1D* h;
7 
8 
9 
10  ////No Cuts entries///////////
11  f1->GetObject("ndNoCuts/hist",h);
12  int n1 = h->GetEntries();
13  double n1f = n1 ;//*0.2416918429 ;
14  std::cout<<std::setprecision(10)<<"Total entries (No Cuts): "<<n1f<<std::endl;
15  f1->GetObject("ndNoCutNCPi0L/hist",h);
16  int n2 = h->GetEntries();
17  double n2f = n2 ;// *0.2416918429 ;
18  std::cout<<std::setprecision(10)<<"NC Pi0 < 0.3 E (No Cuts): "<<n2f<<std::endl;
19  f1->GetObject("ndNoCutNCPi0/hist",h);
20  int n3 = h->GetEntries();
21  double n3f = n3 ;// * 0.2416918429;
22  std::cout<<std::setprecision(10)<<"NC Pi0 > 0.3 E (No Cuts 'Signal'): "<<n3f<<std::endl;
23  f1->GetObject("ndNoCutNCNonPi0/hist",h);
24  int n4 = h->GetEntries();
25  double n4f = n4 ;// * 0.2416918429;
26  std::cout<<std::setprecision(10)<<"NC Non Pi0 (No Cuts): "<<n4f<<std::endl;
27  f1->GetObject("ndNoCutCCNonPi0/hist",h);
28  int n5 = h->GetEntries();
29  double n5f = n5 ;// * 0.2416918429;
30  std::cout<<std::setprecision(10)<<"CC Non Pi0 (No Cuts): "<<n5f<<std::endl;
31  f1->GetObject("ndNoCutCCPi0/hist",h);
32  int n6 = h->GetEntries();
33  double n6f = n6 ;// * 0.2416918429;
34  std::cout<<std::setprecision(10)<<"CC Pi0 (No Cuts): "<<n6f<<std::endl;
35 
36 
37 
38  /////PreSel + 2 Prong Cuts entries//////
39  f1->GetObject("ndMC3PRem/hist",h);
40  int n7 = h->GetEntries();
41  double n7f = n7 ;// * 0.2416918429;
42  std::cout<<std::setprecision(10)<<"Total entries (PreSel + 2 prong Cuts): "<<n7f<<std::endl;
43  f1->GetObject("ndNCPi0Rem/hist",h);
44  int n8 = h->GetEntries();
45  double n8f = n8 ;// * 0.2416918429;
46  std::cout<<std::setprecision(10)<<"NC Pi0 (PreSel + 2 prong 'Signal' Cuts): "<<n8f<<std::endl;
47  f1->GetObject("ndNCPi0LRem/hist",h);
48  int n9 = h->GetEntries();
49  double n9f = n9 ;// * 0.2416918429;
50  std::cout<<std::setprecision(10)<<"NC Pi0 < 0.3 E (PreSel + 2 prong Cuts): "<<n9f<<std::endl;
51  f1->GetObject("ndNCNonPi0Rem/hist",h);
52  int n10 = h->GetEntries();
53  double n10f = n10 ;// * 0.2416918429;
54  std::cout<<std::setprecision(10)<<"NC Non Pi0 (PreSel + 2 prong Cuts): "<<n10f<<std::endl;
55  f1->GetObject("ndCCNonPi0Rem/hist",h);
56  int n11 = h->GetEntries();
57  double n11f = n11 ;//* 0.2416918429;
58  std::cout<<std::setprecision(10)<<"CC Non Pi0 (PreSel + 2 prong Cuts): "<<n11f<<std::endl;
59  f1->GetObject("ndCCPi0Rem/hist",h);
60  int n12 = h->GetEntries();
61  double n12f = n12 ;// * 0.2416918429;
62  std::cout<<std::setprecision(10)<<"CC Pi0 (PreSel + 2 prong Cuts): "<<n12f<<std::endl;
63 
64 
65 
66  /////PreSel + RemID < 0.36 + 2 Prong Cuts entries//////
67 
68  f1->GetObject("ndCVNMC3PR/hist",h);
69  int n13 = h->GetEntries();
70  double n13f = n13 ;//* 0.2416918429;
71  std::cout<<std::setprecision(10)<<"Total entries (PreSel + 2 prong + RemID < 0.36 Cuts): "<<n13f<<std::endl;
72  f1->GetObject("ndCVNNCPi0R/hist",h);
73  int n14 = h->GetEntries();
74  double n14f = n14 ;// * 0.2416918429;
75  std::cout<<std::setprecision(10)<<"NC Pi0 (PreSel + 2 prong + RemID < 0.36 'Signal' Cuts ): "<<n14f<<std::endl;
76  f1->GetObject("ndCVNNCPi0LR/hist",h);
77  int n15 = h->GetEntries();
78  double n15f = n15 ;// * 0.2416918429;
79  std::cout<<std::setprecision(10)<<"NC Pi0 < 0.3 E (PreSel + 2 prong + RemID < 0.36 Cuts): "<<n15f<<std::endl;
80  f1->GetObject("ndCVNNCNonPi0R/hist",h);
81  int n16 = h->GetEntries();
82  double n16f = n16 ;// * 0.2416918429;
83  std::cout<<std::setprecision(10)<<"NC Non Pi0 (PreSel + 2 prong + RemID < 0.36 Cuts): "<<n16f<<std::endl;
84  f1->GetObject("ndCVNCCNonPi0R/hist",h);
85  int n17 = h->GetEntries();
86  double n17f = n17 ;// *0.2416918429 ;
87  std::cout<<std::setprecision(10)<<"CC Non Pi0 (PreSel + 2 prong + RemID < 0.36 Cuts): "<<n17f<<std::endl;
88  f1->GetObject("ndCVNCCPi0R/hist",h);
89  int n18 = h->GetEntries();
90  double n18f = n18 ;// * 0.2416918429;
91  std::cout<<std::setprecision(10)<<"CC Pi0 (PreSel + 2 prong + RemID < 0.36 Cuts): "<<n18f<<std::endl;
92 
93 /////PreSel + RemID < 0.36 + 2 Prong Cuts + Prong 1 CVN cuts entries//////
94 
95  f1->GetObject("ndCVNMC3P/hist",h);
96  int n19 = h->GetEntries();
97  double n19f = n19 ;//* 0.2416918429;
98  std::cout<<std::setprecision(10)<<"Total entries (PreSel + 2 prong + RemID < 0.36 + Prong CVN 1 Cuts): "<<n19f<<std::endl;
99  f1->GetObject("ndCVNNCPi0/hist",h);
100  int n20 = h->GetEntries();
101  double n20f = n20 ;//*0.2416918429 ;
102  std::cout<<std::setprecision(10)<<"NC Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 CVN 'Signal' Cuts ): "<<n20f<<std::endl;
103  f1->GetObject("ndCVNNCPi0L/hist",h);
104  int n21 = h->GetEntries();
105  double n21f = n21 ;// * 0.2416918429;
106  std::cout<<std::setprecision(10)<<"NC Pi0 < 0.635 E (PreSel + 2 prong + RemID < 0.36 + Prong 1 CVN Cuts): "<<n21f<<std::endl;
107  f1->GetObject("ndCVNNCNonPi0/hist",h);
108  int n22 = h->GetEntries();
109  double n22f = n22 ;//* 0.2416918429;
110  std::cout<<std::setprecision(10)<<"NC Non Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 CVN Cuts): "<<n22f<<std::endl;
111  f1->GetObject("ndCVNCCNonPi0/hist",h);
112  int n23 = h->GetEntries();
113  double n23f = n23 ;//* 0.2416918429;
114  std::cout<<std::setprecision(10)<<"CC Non Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 CVN Cuts): "<<n23f<<std::endl;
115  f1->GetObject("ndCVNCCPi0/hist",h);
116  int n24 = h->GetEntries();
117  double n24f = n24 ;//* 0.2416918429;
118  std::cout<<std::setprecision(10)<<"CC Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 CVN Cuts): "<<n24f<<std::endl;
119 
120  /////PreSel + RemID < 0.36 + 2 Prong Cuts + Prong 1 & 2 CVN cuts entries/////
121 
122  f1->GetObject("ndMC3P/hist",h);
123  int n25 = h->GetEntries();
124  double n25f = n25 ;// * 0.2416918429;
125  std::cout<<std::setprecision(10)<<"Total entries (PreSel + 2 prong + RemID < 0.36 + Prong 1 & 2 CVN cuts ): "<<n25f<<std::endl;
126  f1->GetObject("ndNCPi0/hist",h);
127  int n26 = h->GetEntries();
128  double n26f = n26 ;// * 0.2416918429;
129  std::cout<<std::setprecision(10)<<"NC Pi0 (PreSel + 2 prong + RemID < 0.36 'Signal'+ Prong 1 & 2 CVN cuts): "<<n26f<<std::endl;
130  f1->GetObject("ndNCPi0L/hist",h);
131  int n27 = h->GetEntries();
132  double n27f = n27 ;// * 0.2416918429;
133  std::cout<<std::setprecision(10)<<"NC Pi0 < 0.635 E (PreSel + 2 prong + RemID < 0.36 + Prong 1 & 2 CVN cuts): "<<n27f<<std::endl;
134  f1->GetObject("ndNCNonPi0/hist",h);
135  int n28 = h->GetEntries();
136  double n28f = n28 ;// * 0.2416918429 ;
137  std::cout<<std::setprecision(10)<<"NC Non Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 & 2 CVN cuts): "<<n28f<<std::endl;
138  f1->GetObject("ndCCNonPi0/hist",h);
139  int n29 = h->GetEntries();
140  double n29f = n29 ;// *0.2416918429 ;
141  std::cout<<std::setprecision(10)<<"CC Non Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 & 2 CVN cuts): "<<n29f<<std::endl;
142  f1->GetObject("ndCCPi0/hist",h);
143  int n30 = h->GetEntries();
144  double n30f = n30 ;// * 0.2416918429;
145  std::cout<<std::setprecision(10)<<"CC Pi0 (PreSel + 2 prong + RemID < 0.36 + Prong 1 & 2 CVN cuts): "<<n30f<<std::endl;
146 
147 
148 
149  /////Efficiencies////
150 
151  std::cout<<"-------------Efficiency--------------->"<<std::endl;
152 
153  double NoCutEff = n3f/n3f;
154  std::cout<<std::setprecision(7)<<"No Cuts Efficiency: "<<NoCutEff<<std::endl;
155 
156  double PreSel3PngEff = n8f/n3f ;
157  std::cout<<std::setprecision(7)<<"PreSel + 2 prong Efficiency: "<<PreSel3PngEff<<std::endl;
158 
159  double PreSel3PngRemEff = n14f/n3f ;
160  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + RemID < 0.36 Efficiency: "<<PreSel3PngRemEff<<std::endl;
161 
162  double PreSel3Png1CVNRemEff = n20f/n3f ;
163  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + RemID < 0.36 + Prong 1 Efficiency: "<<PreSel3Png1CVNRemEff<<std::endl;
164 
165  double PreSel3PngRem12CVNEff = n26f/n3f ;
166  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + RemID < 0.36 + Png 1 & 2 CVN Efficiency: "<<PreSel3PngRem12CVNEff<<std::endl;
167 
168  ////Purity//////
169 
170  std::cout<<"-------------Purity--------------->"<<std::endl;
171 
172  double NoCutPur = n3f/n1f ;
173  std::cout<<std::setprecision(7)<<"No Cuts Purity: "<<NoCutPur<<std::endl;
174  double PreSel3PngPur = n8f/n7f ;
175  std::cout<<std::setprecision(7)<<"PreSel + 2 prong Purity: "<<PreSel3PngPur<<std::endl;
176  double PreSel3PngRemPur = n14f/n13f ;
177  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID Purity: "<<PreSel3PngRemPur<<std::endl;
178  double PreSel3PngRem1CVNPur = n20f/n19f ;
179  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID + Prong 1 Purity: "<<PreSel3PngRem1CVNPur<<std::endl;
180  double PreSel3PngRem12CVNPur = n26f/n25f ;
181  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID + Png 1 & 2 CVN Purity: "<<PreSel3PngRem12CVNPur<<std::endl;
182 
183  ////Standard FOM (Figure Of Merit)///////
184 
185 
186  std::cout<<"-------------FOM (Standard Figure Of Merit)--------------->"<<std::endl;
187 
188  double NoCutFOM = n3f/sqrt(n1f) ;
189  std::cout<<std::setprecision(7)<<"No Cuts FOM: "<<NoCutFOM<<std::endl;
190  double PreSel3PngFOM = n8f/sqrt(n7f) ;
191  std::cout<<std::setprecision(7)<<"PreSel + 2 prong FOM: "<<PreSel3PngFOM<<std::endl;
192  double PreSel3PngRemFOM = n14f/sqrt(n13f) ;
193  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID FOM: "<<PreSel3PngRemFOM<<std::endl;
194  double PreSel3PngRem1CVNFOM = n20f/sqrt(n19f);
195  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID + Prong 1 FOM: "<<PreSel3PngRem1CVNFOM<<std::endl;
196  double PreSel3PngRem12CVNFOM = n26f/sqrt(n25f) ;
197  std::cout<<std::setprecision(7)<<"PreSel + 2 prong + remID + Png 1 & 2 CVN FOM: "<<PreSel3PngRem12CVNFOM<<std::endl;
198 
199  TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
200 
201  c1->SetFillColor(42);
202  c1->SetGrid();
203  const Int_t n = 5;
204  Float_t y[n] = {NoCutPur,PreSel3PngPur,PreSel3PngRemPur,PreSel3PngRem1CVNPur,PreSel3PngRem12CVNPur};
205  //Float_t x[n] = {NoCutEff,PreSel3PngEff,PreSel3PngRemEff ,PreSel3Png1CVNRemEff,PreSel3PngRem12CVNEff};
206  Float_t x[n] = {10,20,30,40,50};
207 
208  TGraph *gr1 = new TGraph(n,x,y);
209  gr1->SetLineColor(4);
210  gr1->Draw("AL");
211 
212 }
213 
214 
215 
T sqrt(T number)
Definition: d0nt_math.hpp:156
TGraph * gr1
Definition: compare.C:42
Float_t f1
OStream cout
Definition: OStream.cxx:6
c1
Definition: demo5.py:24
void efficiencycalc()
Definition: efficiencycalc.C:1