FD_Data_PosComp.C
Go to the documentation of this file.
1 //..................................
6 
10 
11 #include "CAFAna/Core/Binning.h"
12 #include "CAFAna/Core/Loaders.h"
14 #include "CAFAna/Core/Var.h"
15 #include "CAFAna/Core/Spectrum.h"
17 
18 #include "CAFAna/Vars/HistAxes.h"
21 #include "CAFAna/Vars/XsecTunes.h"
22 
24 
26 
27 #include "Utilities/rootlogon.C"
28 #include "OscLib/OscCalcPMNSOpt.h"
29 
30 #include "TAttLine.h"
31 #include "TAttMarker.h"
32 #include "TCanvas.h"
33 #include "TColor.h"
34 #include "TFile.h"
35 #include "TGraph.h"
36 #include "TH1.h"
37 #include "TH2.h"
38 #include "TLatex.h"
39 #include "TLegend.h"
40 #include "TLine.h"
41 #include "TStyle.h"
42 
43 #include <cmath>
44 #include <iostream>
45 #include <fstream>
46 #include <vector>
47 #include <string>
48 #include <TROOT.h>
49 #include <TStyle.h>
50 //..................................
51 //..................................
52 using namespace ana;
53 //..................................
54 //..................................
55 const Var kMyShwStartX ([](const caf::SRProxy* sr) { return kShwStartX(sr)/100; });
56 const Var kMyShwStartY ([](const caf::SRProxy* sr) { return kShwStartY(sr)/100; });
57 const Var kMyShwStartZ ([](const caf::SRProxy* sr) { return kShwStartZ(sr)/100; });
58 //..................................
59 //..................................
60 void MakeTextFile( std::string CanNa, std::string Txt ) {
61  // Determine output name, and caption.
62  std::string FNa = CanNa +".txt";
63  std::string Cap = "Plot showing "+Txt+". ";
64  // Data or MC?
65  if (Txt.find("Data Only") != std::string::npos) {
66  Cap += "The red box shows the extent of the detector. ";
67  } else {
68  Cap += "The background shows the expected MC distribution, and is shaped to the extent of the detector .";
69  }
70  // NuMu / Nue / Core / Peri
71  if (Txt.find("NuMu") != std::string::npos ) {
72  Cap += "The solid points represent the selected data events.";
73  } else if (Txt.find("Core") != std::string::npos ) {
74  Cap += "The solid points represent the selected data events in the core sample.";
75  } else if (Txt.find("Peripheral") != std::string::npos ) {
76  Cap += "The stars represent the selected data events in the peripheral sample.";
77  } else if (Txt.find("Nue") != std::string::npos ) {
78  Cap += "The solid points and the stars represent the selected data events in the core and peripheral samples respectively.";
79  }
80  std::cout << "\tCap: " << Cap << std::endl;
81  // Write to file.
82  std::ofstream TxtOut ( FNa.c_str(), std::ofstream::out );
83  TxtOut << Cap;
84  TxtOut.close();
85  // Done.
86  return;
87 }
88 //..................................
89 void FixMCHist( TH2* hist, std::string type ) {
90  // Scale histogram
91  double max = hist->GetBinContent(hist->GetMaximumBin());
92  hist->Scale(1./max);
93  // Set axis titles.
94  hist->SetTitle("");
95  if (type=="XY") {
96  hist->GetXaxis()->SetTitle("Vertex X position (m)"); hist->GetYaxis()->SetTitle("Vertex Y position (m)");
97  hist->GetXaxis()->SetRangeUser(-8, 8 ); hist->GetYaxis()->SetRangeUser(-8, 8);
98  } else if (type=="XZ" ) {
99  hist->GetXaxis()->SetTitle("Vertex Z position (m)"); hist->GetYaxis()->SetTitle("Vertex X position (m)");
100  hist->GetXaxis()->SetRangeUser( 0, 60); hist->GetYaxis()->SetRangeUser(-8, 8);
101  } else if (type=="YZ" ) {
102  hist->GetXaxis()->SetTitle("Vertex Z position (m)"); hist->GetYaxis()->SetTitle("Vertex Y position (m)");
103  hist->GetXaxis()->SetRangeUser( 0, 60); hist->GetYaxis()->SetRangeUser(-8, 8);
104  }
105  hist->GetYaxis()->SetTitleOffset(0.7);
106  hist->GetZaxis()->SetTitle("Arbitrary units");
107  CenterTitles(hist);
108 }
109 //..................................
110 void FixDataHist( TGraph* gr, std::string type, bool IsPeri ) {
111  // Set marker properties
112  gr->SetMarkerStyle(20);
113  if (IsPeri) gr->SetMarkerStyle(29);
114  gr->SetMarkerSize(1.5);
115  // Set axis titles.
116  gr->SetTitle("");
117  if (type=="XY") {
118  gr->GetXaxis()->SetTitle("Vertex X position (m)"); gr->GetYaxis()->SetTitle("Vertex Y position (m)");
119  gr->GetXaxis()->SetRangeUser(-10, 10); gr->GetYaxis()->SetRangeUser(-10, 10);
120  } else if (type=="XZ" ) {
121  gr->GetXaxis()->SetTitle("Vertex Z position (m)"); gr->GetYaxis()->SetTitle("Vertex X position (m)");
122  gr->GetXaxis()->SetRangeUser(-5 , 65); gr->GetYaxis()->SetRangeUser(-10, 10);
123  } else if (type=="YZ" ) {
124  gr->GetXaxis()->SetTitle("Vertex Z position (m)"); gr->GetYaxis()->SetTitle("Vertex Y position (m)");
125  gr->GetXaxis()->SetRangeUser(-5 , 65); gr->GetYaxis()->SetRangeUser(-10, 10);
126  }
127  gr->GetXaxis()->CenterTitle();
128  gr->GetYaxis()->CenterTitle();
129 }
130 //..................................
131 //..................................
132 //..................................
133 void FD_Data_PosComp( bool IsFHC = true )
134 {
135  // ---- First off, lets set the styles...
136  gROOT->SetStyle("novaStyle");
137  gStyle->SetPalette(87); // https://root.cern.ch/doc/master/classTColor.html
138 
139  // --- Flick between horn currents.
141  std::string sFHC = "fhc";
142  double MyPOT = kAna2020FHCPOT;
143  if (!IsFHC) {
144  flux = Loaders::kRHC;
145  sFHC = "rhc";
146  MyPOT = kAna2020RHCPOT;
147  }
148  std::string PlotDir = "plots_position_"+sFHC+"/";
149  gSystem -> MakeDirectory( PlotDir.c_str() );
150 
151  // --- Make all of my loaders.
152  Loaders *MCLoader_numu = new Prod5NomLoaders( ECAFType::kNumuConcat, flux );
153  Loaders *MCLoader_nue = new Prod5NomLoaders( ECAFType::kNueConcat , flux );
154  std::string DataLoader_numu = "prod_sumrestricteddecaf_R19-11-18-prod5reco.combi_opt2_fd_numi_"+sFHC+"_full_v1_numu2020_fddatav2";
155  std::string DataLoader_nue = "prod_sumrestricteddecaf_R19-11-18-prod5reco.combi_opt2_fd_numi_"+sFHC+"_full_v1_nue2020_fddatav2";
156 
157  // --- Define my binnnings.
158  const Binning XBins = Binning::Simple(20, -10, 10 );
159  const Binning YBins = Binning::Simple(20, -10, 10 );
160  const Binning ZBins = Binning::Simple(31, -2 , 60);
161 
162  // --- Make my 2D Vars.
163  // numu
164  const ana::HistAxis kXYSt_numu( {"X Start Pos (cm)", "Y Start Pos (cm)"}, {XBins, YBins}, {kTrkStartX, kTrkStartY} );
165  const ana::HistAxis kZXSt_numu( {"Z Start Pos (cm)", "X Start Pos (cm)"}, {ZBins, XBins}, {kTrkStartZ, kTrkStartX} );
166  const ana::HistAxis kZYSt_numu( {"Z Start Pos (cm)", "Y Start Pos (cm)"}, {ZBins, YBins}, {kTrkStartZ, kTrkStartY} );
167  // nue
168  const ana::HistAxis kXYSt_nue ( {"X Start Pos (cm)", "Y Start Pos (cm)"}, {XBins, YBins}, {kMyShwStartX, kMyShwStartY} );
169  const ana::HistAxis kZXSt_nue ( {"Z Start Pos (cm)", "X Start Pos (cm)"}, {ZBins, XBins}, {kMyShwStartZ, kMyShwStartX} );
170  const ana::HistAxis kZYSt_nue ( {"Z Start Pos (cm)", "Y Start Pos (cm)"}, {ZBins, YBins}, {kMyShwStartZ, kMyShwStartY} );
171 
172  // --- Define my spectra.
173  const Var kMyWgt = kPPFXFluxCVWgt*kXSecCVWgt2020;
174  // X vs Y
175  PredictionNoExtrap* XvsY_MC_numu = new PredictionNoExtrap( *MCLoader_numu, kXYSt_numu, kNumu2020FD, kNoShift, kMyWgt );
176  PredictionNoExtrap* XvsY_MC_Core = new PredictionNoExtrap( *MCLoader_nue , kXYSt_nue , kNue2020FD , kNoShift, kMyWgt );
177  // X vs Z
178  PredictionNoExtrap* XvsZ_MC_numu = new PredictionNoExtrap( *MCLoader_numu, kZXSt_numu, kNumu2020FD, kNoShift, kMyWgt );
179  PredictionNoExtrap* XvsZ_MC_Core = new PredictionNoExtrap( *MCLoader_nue , kZXSt_nue , kNue2020FD , kNoShift, kMyWgt );
180  // Y vs Z
181  PredictionNoExtrap* YvsZ_MC_numu = new PredictionNoExtrap( *MCLoader_numu, kZYSt_numu, kNumu2020FD, kNoShift, kMyWgt );
182  PredictionNoExtrap* YvsZ_MC_Core = new PredictionNoExtrap( *MCLoader_nue , kZYSt_nue , kNue2020FD , kNoShift, kMyWgt );
183  MCLoader_numu->Go();
184  MCLoader_nue ->Go();
185 
186  // --- And make my 2D hists...
188  calc -> SetdCP ( 2*M_PI );
189  calc -> SetTh23 ( asin(sqrt(0.565)) );
190  calc -> SetDmsq32( 2.48e-3 );
191 
192  // X vs Y
193  TH2* hXvsY_MC_numu = XvsY_MC_numu->Predict(calc).ToTH2(MyPOT);
194  TH2* hXvsY_MC_Core = XvsY_MC_Core->Predict(calc).ToTH2(MyPOT);
195  // X vs Z
196  TH2* hXvsZ_MC_numu =XvsZ_MC_numu->Predict(calc).ToTH2(MyPOT);
197  TH2* hXvsZ_MC_Core =XvsZ_MC_Core->Predict(calc).ToTH2(MyPOT);
198  // Y vs Z
199  TH2* hYvsZ_MC_numu =YvsZ_MC_numu->Predict(calc).ToTH2(MyPOT);
200  TH2* hYvsZ_MC_Core =YvsZ_MC_Core->Predict(calc).ToTH2(MyPOT);
201 
202  // --- Make my data graphs.
203  // X vs Y
204  TGraph* gXvsY_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartX , kTrkStartY , &kStandardSpillCuts);
205  TGraph* gXvsY_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartX, kMyShwStartY, &kStandardSpillCuts);
206  TGraph* gXvsY_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartX, kMyShwStartY, &kStandardSpillCuts);
207  // X vs Z
208  TGraph* gXvsZ_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartZ , kTrkStartX , &kStandardSpillCuts);
209  TGraph* gXvsZ_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartZ, kMyShwStartX, &kStandardSpillCuts);
210  TGraph* gXvsZ_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartZ, kMyShwStartX, &kStandardSpillCuts);
211  // Y vs Z
212  TGraph* gYvsZ_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartZ , kTrkStartY , &kStandardSpillCuts);
213  TGraph* gYvsZ_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartZ, kMyShwStartY, &kStandardSpillCuts);
214  TGraph* gYvsZ_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartZ, kMyShwStartY, &kStandardSpillCuts);
215 
216  // --- Format my histograms.
217  // XY
218  FixMCHist( hXvsY_MC_numu, "XY" ); FixDataHist( gXvsY_numu, "XY", false );
219  FixMCHist( hXvsY_MC_Core, "XY" ); FixDataHist( gXvsY_Core, "XY", false ); FixDataHist( gXvsY_Peri, "XY", true );
220  // XZ
221  FixMCHist( hXvsZ_MC_numu, "XZ" ); FixDataHist( gXvsZ_numu, "XZ", false );
222  FixMCHist( hXvsZ_MC_Core, "XZ" ); FixDataHist( gXvsZ_Core, "XZ", false ); FixDataHist( gXvsZ_Peri, "XZ", true );
223  // YZ
224  FixMCHist( hYvsZ_MC_numu, "YZ" ); FixDataHist( gYvsZ_numu, "YZ", false );
225  FixMCHist( hYvsZ_MC_Core, "YZ" ); FixDataHist( gYvsZ_Core, "YZ", false ); FixDataHist( gYvsZ_Peri, "YZ", true );
226 
227  // --- Declare all of my detector extent lines.
228  // XY.
229  TLine *XvsY_L1 = new TLine( -7.7, -7.7, -7.7, 7.7 ); XvsY_L1->SetLineColor(kRed); XvsY_L1->SetLineWidth(4); XvsY_L1->SetLineStyle(2);
230  TLine *XvsY_L2 = new TLine( 7.7, -7.7, 7.7, 7.7 ); XvsY_L2->SetLineColor(kRed); XvsY_L2->SetLineWidth(4); XvsY_L2->SetLineStyle(2);
231  TLine *XvsY_L3 = new TLine( -7.7, -7.7, 7.7, -7.7 ); XvsY_L3->SetLineColor(kRed); XvsY_L3->SetLineWidth(4); XvsY_L3->SetLineStyle(2);
232  TLine *XvsY_L4 = new TLine( -7.7, 7.7, 7.7, 7.7 ); XvsY_L4->SetLineColor(kRed); XvsY_L4->SetLineWidth(4); XvsY_L4->SetLineStyle(2);
233  // XZ
234  TLine *XvsZ_L1 = new TLine( 0 , -7.7, 0 , 7.7 ); XvsZ_L1->SetLineColor(kRed); XvsZ_L1->SetLineWidth(4); XvsZ_L1->SetLineStyle(2);
235  TLine *XvsZ_L2 = new TLine( 59.8, -7.7, 59.8, 7.7 ); XvsZ_L2->SetLineColor(kRed); XvsZ_L2->SetLineWidth(4); XvsZ_L2->SetLineStyle(2);
236  TLine *XvsZ_L3 = new TLine( 0 , -7.7, 59.8, -7.7 ); XvsZ_L3->SetLineColor(kRed); XvsZ_L3->SetLineWidth(4); XvsZ_L3->SetLineStyle(2);
237  TLine *XvsZ_L4 = new TLine( 0 , 7.7, 59.8, 7.7 ); XvsZ_L4->SetLineColor(kRed); XvsZ_L4->SetLineWidth(4); XvsZ_L4->SetLineStyle(2);
238  // YZ
239  TLine *YvsZ_L1 = new TLine( 0 , -7.7, 0 , 7.7 ); YvsZ_L1->SetLineColor(kRed); YvsZ_L1->SetLineWidth(4); YvsZ_L1->SetLineStyle(2);
240  TLine *YvsZ_L2 = new TLine( 59.8, -7.7, 59.8, 7.7 ); YvsZ_L2->SetLineColor(kRed); YvsZ_L2->SetLineWidth(4); YvsZ_L2->SetLineStyle(2);
241  TLine *YvsZ_L3 = new TLine( 0 , -7.7, 59.8, -7.7 ); YvsZ_L3->SetLineColor(kRed); YvsZ_L3->SetLineWidth(4); YvsZ_L3->SetLineStyle(2);
242  TLine *YvsZ_L4 = new TLine( 0 , 7.7, 59.8, 7.7 ); YvsZ_L4->SetLineColor(kRed); YvsZ_L4->SetLineWidth(4); YvsZ_L4->SetLineStyle(2);
243 
244  std::string ThisName = "";
245  // .............................. X vs Y ..............................
246  TH2D *hXY = new TH2D( "hXYMC", ";Vertex X position (m);Vertex Y position (m)", 20, -10, 10, 20, -10, 10 );
247  // First draw numu canvas with data only.
248  TCanvas* cXY_Da_numu = new TCanvas("cXY_Data_numu","");
249  hXY -> Draw();
250  gXvsY_numu -> Draw("same P");
251  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
252  Preliminary();
253  if (IsFHC) CornerLabel("Neutrino beam");
254  else CornerLabel("Antineutrino beam");
255  ThisName = PlotDir+cXY_Da_numu->GetName()+"_"+sFHC;
256  cXY_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
257  MakeTextFile( ThisName, "X vs Y, NuMu, Data Only" );
258 
259  // Now draw nue canvas with data only.
260  TCanvas* cXY_Da_nue = new TCanvas("cXY_Data_nue","");
261  hXY -> Draw();
262  gXvsY_Core -> Draw("same P");
263  gXvsY_Peri -> Draw("same P");
264  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
265  Preliminary();
266  if (IsFHC) CornerLabel("Neutrino beam");
267  else CornerLabel("Antineutrino beam");
268  ThisName = PlotDir+cXY_Da_nue->GetName()+"_"+sFHC;
269  cXY_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
270  MakeTextFile( ThisName, "X vs Y, Nue, Data Only" );
271 
272  // Now draw nue canvas with Core data only.
273  TCanvas* cXY_Da_Core = new TCanvas("cXY_Data_Core","");
274  hXY -> Draw();
275  gXvsY_Core -> Draw("P same");
276  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
277  Preliminary();
278  if (IsFHC) CornerLabel("Neutrino beam");
279  else CornerLabel("Antineutrino beam");
280  ThisName = PlotDir+cXY_Da_Core->GetName()+"_"+sFHC;
281  cXY_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
282  MakeTextFile( ThisName, "X vs Y, Nue Core Only, Data Only" );
283 
284  // Now draw nue canvas with Peripheral data only.
285  TCanvas* cXY_Da_Peri = new TCanvas("cXY_Data_Peri","");
286  hXY -> Draw();
287  gXvsY_Peri -> Draw("P same");
288  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
289  Preliminary();
290  if (IsFHC) CornerLabel("Neutrino beam");
291  else CornerLabel("Antineutrino beam");
292  ThisName = PlotDir+cXY_Da_Peri->GetName()+"_"+sFHC;
293  cXY_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
294  MakeTextFile( ThisName, "X vs Y, Nue Peripheral Only, Data Only" );
295 
296  // And the numu Monte Carlo background.
297  TCanvas* cXY_MC_numu = new TCanvas("cXY_Mont_numu","");
298  cXY_MC_numu -> SetRightMargin (.15);
299  hXvsY_MC_numu -> Draw("COLZ");
300  gXvsY_numu -> Draw("same P");
301  Preliminary();
302  if (IsFHC) CornerLabel("Neutrino beam");
303  else CornerLabel("Antineutrino beam");
304  ThisName = PlotDir+cXY_MC_numu->GetName()+"_"+sFHC;
305  cXY_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
306  MakeTextFile( ThisName, "X vs Y, NuMu, MC vs Data" );
307 
308  // And the nue Monte Carlo background.
309  TCanvas* cXY_MC_nue = new TCanvas("cXY_Mont_nue","");
310  cXY_MC_nue -> SetRightMargin (.15);
311  hXvsY_MC_Core -> Draw("COLZ");
312  gXvsY_Core -> Draw("same P");
313  gXvsY_Peri -> Draw("same P");
314  Preliminary();
315  if (IsFHC) CornerLabel("Neutrino beam");
316  else CornerLabel("Antineutrino beam");
317  ThisName = PlotDir+cXY_MC_nue->GetName()+"_"+sFHC;
318  cXY_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
319  MakeTextFile( ThisName, "X vs Y, Nue, MC vs Data" );
320 
321  // .............................. X vs Z ..............................
322  TH2D *hXZ = new TH2D( "hXZMC", ";Vertex Z position (m);Vertex X position (m)", 32, -5, 65, 20, -10, 10 );
323  // First draw numu canvas with data only.
324  TCanvas* cXZ_Da_numu = new TCanvas("cXZ_Data_numu","");
325  hXZ -> Draw();
326  gXvsZ_numu -> Draw("same P");
327  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
328  Preliminary();
329  if (IsFHC) CornerLabel("Neutrino beam");
330  else CornerLabel("Antineutrino beam");
331  ThisName = PlotDir+cXZ_Da_numu->GetName()+"_"+sFHC;
332  cXZ_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
333  MakeTextFile( ThisName, "Z vs X, NuMu, Data Only" );
334 
335  // Now draw nue canvas with data only.
336  TCanvas* cXZ_Da_nue = new TCanvas("cXZ_Data_nue","");
337  hXZ -> Draw();
338  gXvsZ_Core -> Draw("same P");
339  gXvsZ_Peri -> Draw("same P");
340  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
341  Preliminary();
342  if (IsFHC) CornerLabel("Neutrino beam");
343  else CornerLabel("Antineutrino beam");
344  ThisName = PlotDir+cXZ_Da_nue->GetName()+"_"+sFHC;
345  cXZ_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
346  MakeTextFile( ThisName, "Z vs X, Nue, Data Only" );
347 
348  // Now draw nue canvas with Core data only.
349  TCanvas* cXZ_Da_Core = new TCanvas("cXZ_Data_Core","");
350  hXZ->Draw();
351  gXvsZ_Core -> Draw("same P");
352  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
353  Preliminary();
354  if (IsFHC) CornerLabel("Neutrino beam");
355  else CornerLabel("Antineutrino beam");
356  ThisName = PlotDir+cXZ_Da_Core->GetName()+"_"+sFHC;
357  cXZ_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
358  MakeTextFile( ThisName, "Z vs X, Nue Core Only, Data Only" );
359 
360  // Now draw nue canvas with Peripheral data only.
361  TCanvas* cXZ_Da_Peri = new TCanvas("cXZ_Data_Peri","");
362  hXZ->Draw();
363  gXvsZ_Peri -> Draw("same P");
364  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
365  Preliminary();
366  if (IsFHC) CornerLabel("Neutrino beam");
367  else CornerLabel("Antineutrino beam");
368  ThisName = PlotDir+cXZ_Da_Peri->GetName()+"_"+sFHC;
369  cXZ_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
370  MakeTextFile( ThisName, "Z vs X, Nue Peripheral Only, Data Only" );
371 
372  // And the numu Monte Carlo background.
373  TCanvas* cXZ_MC_numu = new TCanvas("cXZ_Mont_numu","");
374  cXZ_MC_numu -> SetRightMargin (.15);
375  hXvsZ_MC_numu -> Draw("COLZ");
376  gXvsZ_numu -> Draw("same P");
377  Preliminary();
378  if (IsFHC) CornerLabel("Neutrino beam");
379  else CornerLabel("Antineutrino beam");
380  ThisName = PlotDir+cXZ_MC_numu->GetName()+"_"+sFHC;
381  cXZ_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
382  MakeTextFile( ThisName, "Z vs X, NuMu, MC vs Data" );
383 
384  // And the nue Monte Carlo background.
385  TCanvas* cXZ_MC_nue = new TCanvas("cXZ_Mont_nue","");
386  cXZ_MC_nue -> SetRightMargin (.15);
387  hXvsZ_MC_Core -> Draw("COLZ");
388  gXvsZ_Core -> Draw("same P");
389  gXvsZ_Peri -> Draw("same P");
390  Preliminary();
391  if (IsFHC) CornerLabel("Neutrino beam");
392  else CornerLabel("Antineutrino beam");
393  ThisName = PlotDir+cXZ_MC_nue->GetName()+"_"+sFHC;
394  cXZ_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
395  MakeTextFile( ThisName, "Z vs X, Nue, MC vs Data" );
396 
397  // .............................. Y vs Z ..............................
398  TH2D *hYZ = new TH2D( "hYZMC", ";Vertex Z position (m);Vertex Y position (m)", 32, -5, 65, 20, -10, 10 );
399  // First draw numu canvas with data only.
400  TCanvas* cYZ_Da_numu = new TCanvas("cYZ_Data_numu","");
401  hYZ->Draw();
402  gYvsZ_numu -> Draw("same P");
403  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
404  Preliminary();
405  if (IsFHC) CornerLabel("Neutrino beam");
406  else CornerLabel("Antineutrino beam");
407  ThisName = PlotDir+cYZ_Da_numu->GetName()+"_"+sFHC;
408  cYZ_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
409  MakeTextFile( ThisName, "Z vs Y, NuMu, Data Only" );
410 
411  // Now draw nue canvas with data only.
412  TCanvas* cYZ_Da_nue = new TCanvas("cYZ_Data_nue","");
413  hYZ->Draw();
414  gYvsZ_Core -> Draw("same P");
415  gYvsZ_Peri -> Draw("same P");
416  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
417  Preliminary();
418  if (IsFHC) CornerLabel("Neutrino beam");
419  else CornerLabel("Antineutrino beam");
420  ThisName = PlotDir+cYZ_Da_nue->GetName()+"_"+sFHC;
421  cYZ_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
422  MakeTextFile( ThisName, "Z vs Y, Nue, Data Only" );
423 
424  // Now draw nue canvas with Core data only.
425  TCanvas* cYZ_Da_Core = new TCanvas("cYZ_Data_Core","");
426  hYZ->Draw();
427  gYvsZ_Core -> Draw("same P");
428  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
429  Preliminary();
430  if (IsFHC) CornerLabel("Neutrino beam");
431  else CornerLabel("Antineutrino beam");
432  ThisName = PlotDir+cYZ_Da_Core->GetName()+"_"+sFHC;
433  cYZ_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
434  MakeTextFile( ThisName, "Z vs Y, Nue Core Only, Data Only" );
435 
436  // Now draw nue canvas with Peripheral data only.
437  TCanvas* cYZ_Da_Peri = new TCanvas("cYZ_Data_Peri","");
438  hYZ->Draw();
439  gYvsZ_Peri -> Draw("same P");
440  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
441  Preliminary();
442  if (IsFHC) CornerLabel("Neutrino beam");
443  else CornerLabel("Antineutrino beam");
444  ThisName = PlotDir+cYZ_Da_Peri->GetName()+"_"+sFHC;
445  cYZ_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
446  MakeTextFile( ThisName, "Z vs Y, Nue Peripheral Only, Data Only" );
447 
448  // And the numu Monte Carlo background.
449  TCanvas* cYZ_MC_numu = new TCanvas("cYZ_Mont_numu","");
450  cYZ_MC_numu -> SetRightMargin (.15);
451  hYvsZ_MC_numu -> Draw("COLZ");
452  gYvsZ_numu -> Draw("same P");
453  Preliminary();
454  if (IsFHC) CornerLabel("Neutrino beam");
455  else CornerLabel("Antineutrino beam");
456  ThisName = PlotDir+cYZ_MC_numu->GetName()+"_"+sFHC;
457  cYZ_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
458  MakeTextFile( ThisName, "Z vs Y, NuMu, MC vs Data" );
459 
460  // And the nue Monte Carlo background.
461  TCanvas* cYZ_MC_nue = new TCanvas("cYZ_Mont_nue","");
462  cYZ_MC_nue -> SetRightMargin (.15);
463  hYvsZ_MC_Core -> Draw("COLZ");
464  gYvsZ_Core -> Draw("same P");
465  gYvsZ_Peri -> Draw("same P");
466  Preliminary();
467  if (IsFHC) CornerLabel("Neutrino beam");
468  else CornerLabel("Antineutrino beam");
469  ThisName = PlotDir+cYZ_MC_nue->GetName()+"_"+sFHC;
470  cYZ_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
471  MakeTextFile( ThisName, "Z vs Y, Nue, MC vs Data" );
472 
473  return;
474 }
void FD_Data_PosComp(bool IsFHC=true)
tree Draw("slc.nhit")
void FixMCHist(TH2 *hist, std::string type)
enum BeamMode kRed
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:193
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
bool IsFHC
void MakeTextFile(std::string Plane, std::string Overlay)
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
T sqrt(T number)
Definition: d0nt_math.hpp:156
void CornerLabel(std::string &s)
Definition: numu_tools.h:145
const Var kTrkStartY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.Y()/100;})
Definition: NumuVars.h:52
const Var kShwStartY
void CenterTitles(TH1 *histo)
Definition: Plots.cxx:1483
const Var kMyShwStartZ([](const caf::SRProxy *sr){return kShwStartZ(sr)/100;})
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
Loaders::FluxType flux
#define M_PI
Definition: SbMath.h:34
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
std::string sFHC
Definition: MakeCutFlow.C:35
const Var kShwStartX
void FixDataHist(TGraph *gr, std::string type, bool IsPeri)
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod5Loaders.h:101
Spectrum Predict(osc::IOscCalc *calc) const override
const Var kTrkStartZ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.Z()/100;})
Definition: NumuVars.h:53
const Var kMyShwStartX([](const caf::SRProxy *sr){return kShwStartX(sr)/100;})
caf::StandardRecord * sr
const Cut kNumu2020FD
Definition: NumuCuts2020.h:59
const double kAna2020FHCPOT
Definition: Exposures.h:233
const Cut kNue2020FD
Definition: NueCuts2020.h:65
const double kAna2020RHCPOT
Definition: Exposures.h:235
void Preliminary()
const Var kTrkStartX([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.X()/100;})
Definition: NumuVars.h:51
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
const Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
Definition: TimingCuts.h:8
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Prediction that just uses FD MC, with no extrapolation.
const Var kMyShwStartY([](const caf::SRProxy *sr){return kShwStartY(sr)/100;})
cosmicTree SaveAs("cosmicTree.root")
const Var kShwStartZ
Float_t e
Definition: plot.C:35
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:66
const Cut kNue2020FDPeripheral(kNue2020FDPeripheralFunc)
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
std::string PlotDir
TGraph * MakeGraph(const std::string &wildcard, const Cut &cut, const Var &VarX, const Var &VarY, const SpillCut *spillCut)
Get a graph with two variables when a histogram is not the best choice.
Definition: GraphDrawer.cxx:13
T asin(T number)
Definition: d0nt_math.hpp:60
const Var kXSecCVWgt2020
Definition: XsecTunes.h:105
enum BeamMode string