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  Var kXYVar = Var2D( kTrkStartX, XBins, kTrkStartY, YBins ), kXYVar_nue = Var2D( kMyShwStartX, XBins, kMyShwStartY, YBins );
164  Var kXZVar = Var2D( kTrkStartZ, ZBins, kTrkStartX, XBins ), kXZVar_nue = Var2D( kMyShwStartZ, ZBins, kMyShwStartX, XBins );
165  Var kYZVar = Var2D( kTrkStartZ, ZBins, kTrkStartY, YBins ), kYZVar_nue = Var2D( kMyShwStartZ, ZBins, kMyShwStartY, YBins );
166  const Binning XYBins = Binning::Simple(400, 0, 400 );
167  const Binning XZBins = Binning::Simple(620, 0, 620 );
168  const Binning YZBins = Binning::Simple(620, 0, 620 );
169  // --- Define my spectra.
170  const Var kMyWgt = kPPFXFluxCVWgt*kXSecCVWgt2020;
171  // X vs Y
172  PredictionNoExtrap* XvsY_MC_numu = new PredictionNoExtrap( *MCLoader_numu, "NuMu Pos in X vs Y (m)", XYBins, kXYVar , kNumu2020FD, kNoShift, kMyWgt );
173  PredictionNoExtrap* XvsY_MC_Core = new PredictionNoExtrap( *MCLoader_nue , "Core Pos in X vs Y (m)", XYBins, kXYVar_nue, kNue2020FD , kNoShift, kMyWgt );
174  // X vs Z
175  PredictionNoExtrap* XvsZ_MC_numu = new PredictionNoExtrap( *MCLoader_numu, "NuMu Pos in X vs Z (m)", XZBins, kXZVar , kNumu2020FD, kNoShift, kMyWgt );
176  PredictionNoExtrap* XvsZ_MC_Core = new PredictionNoExtrap( *MCLoader_nue , "Core Pos in X vs Z (m)", XZBins, kXZVar_nue, kNue2020FD , kNoShift, kMyWgt );
177  // Y vs Z
178  PredictionNoExtrap* YvsZ_MC_numu = new PredictionNoExtrap( *MCLoader_numu, "NuMu Pos in Y vs Z (m)", YZBins, kYZVar , kNumu2020FD, kNoShift, kMyWgt );
179  PredictionNoExtrap* YvsZ_MC_Core = new PredictionNoExtrap( *MCLoader_nue , "Core Pos in Y vs Z (m)", YZBins, kYZVar_nue, kNue2020FD , kNoShift, kMyWgt );
180  MCLoader_numu->Go();
181  MCLoader_nue ->Go();
182 
183  // --- And make my 2D hists...
185  calc -> SetdCP ( 2*M_PI );
186  calc -> SetTh23 ( asin(sqrt(0.565)) );
187  calc -> SetDmsq32( 2.48e-3 );
188 
189  // X vs Y
190  TH2* hXvsY_MC_numu = ana::ToTH2( XvsY_MC_numu->Predict(calc), MyPOT, kPOT, XBins, YBins );
191  TH2* hXvsY_MC_Core = ana::ToTH2( XvsY_MC_Core->Predict(calc), MyPOT, kPOT, XBins, YBins );
192  // X vs Z
193  TH2* hXvsZ_MC_numu = ana::ToTH2( XvsZ_MC_numu->Predict(calc), MyPOT, kPOT, ZBins, XBins );
194  TH2* hXvsZ_MC_Core = ana::ToTH2( XvsZ_MC_Core->Predict(calc), MyPOT, kPOT, ZBins, XBins );
195  // Y vs Z
196  TH2* hYvsZ_MC_numu = ana::ToTH2( YvsZ_MC_numu->Predict(calc), MyPOT, kPOT, ZBins, YBins );
197  TH2* hYvsZ_MC_Core = ana::ToTH2( YvsZ_MC_Core->Predict(calc), MyPOT, kPOT, ZBins, YBins );
198 
199  // --- Make my data graphs.
200  // X vs Y
201  TGraph* gXvsY_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartX , kTrkStartY , &kStandardSpillCuts);
202  TGraph* gXvsY_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartX, kMyShwStartY, &kStandardSpillCuts);
203  TGraph* gXvsY_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartX, kMyShwStartY, &kStandardSpillCuts);
204  // X vs Z
205  TGraph* gXvsZ_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartZ , kTrkStartX , &kStandardSpillCuts);
206  TGraph* gXvsZ_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartZ, kMyShwStartX, &kStandardSpillCuts);
207  TGraph* gXvsZ_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartZ, kMyShwStartX, &kStandardSpillCuts);
208  // Y vs Z
209  TGraph* gYvsZ_numu = MakeGraph( DataLoader_numu, kNumu2020FD && kInBeamSpill, kTrkStartZ , kTrkStartY , &kStandardSpillCuts);
210  TGraph* gYvsZ_Core = MakeGraph( DataLoader_nue , kNue2020FD && kInBeamSpill, kMyShwStartZ, kMyShwStartY, &kStandardSpillCuts);
211  TGraph* gYvsZ_Peri = MakeGraph( DataLoader_nue , kNue2020FDPeripheral && kInBeamSpill, kMyShwStartZ, kMyShwStartY, &kStandardSpillCuts);
212 
213  // --- Format my histograms.
214  // XY
215  FixMCHist( hXvsY_MC_numu, "XY" ); FixDataHist( gXvsY_numu, "XY", false );
216  FixMCHist( hXvsY_MC_Core, "XY" ); FixDataHist( gXvsY_Core, "XY", false ); FixDataHist( gXvsY_Peri, "XY", true );
217  // XZ
218  FixMCHist( hXvsZ_MC_numu, "XZ" ); FixDataHist( gXvsZ_numu, "XZ", false );
219  FixMCHist( hXvsZ_MC_Core, "XZ" ); FixDataHist( gXvsZ_Core, "XZ", false ); FixDataHist( gXvsZ_Peri, "XZ", true );
220  // YZ
221  FixMCHist( hYvsZ_MC_numu, "YZ" ); FixDataHist( gYvsZ_numu, "YZ", false );
222  FixMCHist( hYvsZ_MC_Core, "YZ" ); FixDataHist( gYvsZ_Core, "YZ", false ); FixDataHist( gYvsZ_Peri, "YZ", true );
223 
224  // --- Declare all of my detector extent lines.
225  // XY.
226  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);
227  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);
228  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);
229  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);
230  // XZ
231  TLine *XvsZ_L1 = new TLine( 0 , -7.7, 0 , 7.7 ); XvsZ_L1->SetLineColor(kRed); XvsZ_L1->SetLineWidth(4); XvsZ_L1->SetLineStyle(2);
232  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);
233  TLine *XvsZ_L3 = new TLine( 0 , -7.7, 59.8, -7.7 ); XvsZ_L3->SetLineColor(kRed); XvsZ_L3->SetLineWidth(4); XvsZ_L3->SetLineStyle(2);
234  TLine *XvsZ_L4 = new TLine( 0 , 7.7, 59.8, 7.7 ); XvsZ_L4->SetLineColor(kRed); XvsZ_L4->SetLineWidth(4); XvsZ_L4->SetLineStyle(2);
235  // YZ
236  TLine *YvsZ_L1 = new TLine( 0 , -7.7, 0 , 7.7 ); YvsZ_L1->SetLineColor(kRed); YvsZ_L1->SetLineWidth(4); YvsZ_L1->SetLineStyle(2);
237  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);
238  TLine *YvsZ_L3 = new TLine( 0 , -7.7, 59.8, -7.7 ); YvsZ_L3->SetLineColor(kRed); YvsZ_L3->SetLineWidth(4); YvsZ_L3->SetLineStyle(2);
239  TLine *YvsZ_L4 = new TLine( 0 , 7.7, 59.8, 7.7 ); YvsZ_L4->SetLineColor(kRed); YvsZ_L4->SetLineWidth(4); YvsZ_L4->SetLineStyle(2);
240 
241  std::string ThisName = "";
242  // .............................. X vs Y ..............................
243  TH2D *hXY = new TH2D( "hXYMC", ";Vertex X position (m);Vertex Y position (m)", 20, -10, 10, 20, -10, 10 );
244  // First draw numu canvas with data only.
245  TCanvas* cXY_Da_numu = new TCanvas("cXY_Data_numu","");
246  hXY -> Draw();
247  gXvsY_numu -> Draw("same P");
248  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
249  Preliminary();
250  if (IsFHC) CornerLabel("Neutrino beam");
251  else CornerLabel("Antineutrino beam");
252  ThisName = PlotDir+cXY_Da_numu->GetName()+"_"+sFHC;
253  cXY_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
254  MakeTextFile( ThisName, "X vs Y, NuMu, Data Only" );
255 
256  // Now draw nue canvas with data only.
257  TCanvas* cXY_Da_nue = new TCanvas("cXY_Data_nue","");
258  hXY -> Draw();
259  gXvsY_Core -> Draw("same P");
260  gXvsY_Peri -> Draw("same P");
261  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
262  Preliminary();
263  if (IsFHC) CornerLabel("Neutrino beam");
264  else CornerLabel("Antineutrino beam");
265  ThisName = PlotDir+cXY_Da_nue->GetName()+"_"+sFHC;
266  cXY_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
267  MakeTextFile( ThisName, "X vs Y, Nue, Data Only" );
268 
269  // Now draw nue canvas with Core data only.
270  TCanvas* cXY_Da_Core = new TCanvas("cXY_Data_Core","");
271  hXY -> Draw();
272  gXvsY_Core -> Draw("P same");
273  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
274  Preliminary();
275  if (IsFHC) CornerLabel("Neutrino beam");
276  else CornerLabel("Antineutrino beam");
277  ThisName = PlotDir+cXY_Da_Core->GetName()+"_"+sFHC;
278  cXY_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
279  MakeTextFile( ThisName, "X vs Y, Nue Core Only, Data Only" );
280 
281  // Now draw nue canvas with Peripheral data only.
282  TCanvas* cXY_Da_Peri = new TCanvas("cXY_Data_Peri","");
283  hXY -> Draw();
284  gXvsY_Peri -> Draw("P same");
285  XvsY_L1 -> Draw(); XvsY_L2->Draw(); XvsY_L3->Draw(); XvsY_L4->Draw();
286  Preliminary();
287  if (IsFHC) CornerLabel("Neutrino beam");
288  else CornerLabel("Antineutrino beam");
289  ThisName = PlotDir+cXY_Da_Peri->GetName()+"_"+sFHC;
290  cXY_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
291  MakeTextFile( ThisName, "X vs Y, Nue Peripheral Only, Data Only" );
292 
293  // And the numu Monte Carlo background.
294  TCanvas* cXY_MC_numu = new TCanvas("cXY_Mont_numu","");
295  cXY_MC_numu -> SetRightMargin (.15);
296  hXvsY_MC_numu -> Draw("COLZ");
297  gXvsY_numu -> Draw("same P");
298  Preliminary();
299  if (IsFHC) CornerLabel("Neutrino beam");
300  else CornerLabel("Antineutrino beam");
301  ThisName = PlotDir+cXY_MC_numu->GetName()+"_"+sFHC;
302  cXY_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
303  MakeTextFile( ThisName, "X vs Y, NuMu, MC vs Data" );
304 
305  // And the nue Monte Carlo background.
306  TCanvas* cXY_MC_nue = new TCanvas("cXY_Mont_nue","");
307  cXY_MC_nue -> SetRightMargin (.15);
308  hXvsY_MC_Core -> Draw("COLZ");
309  gXvsY_Core -> Draw("same P");
310  gXvsY_Peri -> Draw("same P");
311  Preliminary();
312  if (IsFHC) CornerLabel("Neutrino beam");
313  else CornerLabel("Antineutrino beam");
314  ThisName = PlotDir+cXY_MC_nue->GetName()+"_"+sFHC;
315  cXY_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
316  MakeTextFile( ThisName, "X vs Y, Nue, MC vs Data" );
317 
318  // .............................. X vs Z ..............................
319  TH2D *hXZ = new TH2D( "hXZMC", ";Vertex Z position (m);Vertex X position (m)", 32, -5, 65, 20, -10, 10 );
320  // First draw numu canvas with data only.
321  TCanvas* cXZ_Da_numu = new TCanvas("cXZ_Data_numu","");
322  hXZ -> Draw();
323  gXvsZ_numu -> Draw("same P");
324  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
325  Preliminary();
326  if (IsFHC) CornerLabel("Neutrino beam");
327  else CornerLabel("Antineutrino beam");
328  ThisName = PlotDir+cXZ_Da_numu->GetName()+"_"+sFHC;
329  cXZ_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
330  MakeTextFile( ThisName, "Z vs X, NuMu, Data Only" );
331 
332  // Now draw nue canvas with data only.
333  TCanvas* cXZ_Da_nue = new TCanvas("cXZ_Data_nue","");
334  hXZ -> Draw();
335  gXvsZ_Core -> Draw("same P");
336  gXvsZ_Peri -> Draw("same P");
337  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
338  Preliminary();
339  if (IsFHC) CornerLabel("Neutrino beam");
340  else CornerLabel("Antineutrino beam");
341  ThisName = PlotDir+cXZ_Da_nue->GetName()+"_"+sFHC;
342  cXZ_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
343  MakeTextFile( ThisName, "Z vs X, Nue, Data Only" );
344 
345  // Now draw nue canvas with Core data only.
346  TCanvas* cXZ_Da_Core = new TCanvas("cXZ_Data_Core","");
347  hXZ->Draw();
348  gXvsZ_Core -> Draw("same P");
349  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
350  Preliminary();
351  if (IsFHC) CornerLabel("Neutrino beam");
352  else CornerLabel("Antineutrino beam");
353  ThisName = PlotDir+cXZ_Da_Core->GetName()+"_"+sFHC;
354  cXZ_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
355  MakeTextFile( ThisName, "Z vs X, Nue Core Only, Data Only" );
356 
357  // Now draw nue canvas with Peripheral data only.
358  TCanvas* cXZ_Da_Peri = new TCanvas("cXZ_Data_Peri","");
359  hXZ->Draw();
360  gXvsZ_Peri -> Draw("same P");
361  XvsZ_L1 -> Draw(); XvsZ_L2->Draw(); XvsZ_L3->Draw(); XvsZ_L4->Draw();
362  Preliminary();
363  if (IsFHC) CornerLabel("Neutrino beam");
364  else CornerLabel("Antineutrino beam");
365  ThisName = PlotDir+cXZ_Da_Peri->GetName()+"_"+sFHC;
366  cXZ_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
367  MakeTextFile( ThisName, "Z vs X, Nue Peripheral Only, Data Only" );
368 
369  // And the numu Monte Carlo background.
370  TCanvas* cXZ_MC_numu = new TCanvas("cXZ_Mont_numu","");
371  cXZ_MC_numu -> SetRightMargin (.15);
372  hXvsZ_MC_numu -> Draw("COLZ");
373  gXvsZ_numu -> Draw("same P");
374  Preliminary();
375  if (IsFHC) CornerLabel("Neutrino beam");
376  else CornerLabel("Antineutrino beam");
377  ThisName = PlotDir+cXZ_MC_numu->GetName()+"_"+sFHC;
378  cXZ_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
379  MakeTextFile( ThisName, "Z vs X, NuMu, MC vs Data" );
380 
381  // And the nue Monte Carlo background.
382  TCanvas* cXZ_MC_nue = new TCanvas("cXZ_Mont_nue","");
383  cXZ_MC_nue -> SetRightMargin (.15);
384  hXvsZ_MC_Core -> Draw("COLZ");
385  gXvsZ_Core -> Draw("same P");
386  gXvsZ_Peri -> Draw("same P");
387  Preliminary();
388  if (IsFHC) CornerLabel("Neutrino beam");
389  else CornerLabel("Antineutrino beam");
390  ThisName = PlotDir+cXZ_MC_nue->GetName()+"_"+sFHC;
391  cXZ_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
392  MakeTextFile( ThisName, "Z vs X, Nue, MC vs Data" );
393 
394  // .............................. Y vs Z ..............................
395  TH2D *hYZ = new TH2D( "hYZMC", ";Vertex Z position (m);Vertex Y position (m)", 32, -5, 65, 20, -10, 10 );
396  // First draw numu canvas with data only.
397  TCanvas* cYZ_Da_numu = new TCanvas("cYZ_Data_numu","");
398  hYZ->Draw();
399  gYvsZ_numu -> Draw("same P");
400  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
401  Preliminary();
402  if (IsFHC) CornerLabel("Neutrino beam");
403  else CornerLabel("Antineutrino beam");
404  ThisName = PlotDir+cYZ_Da_numu->GetName()+"_"+sFHC;
405  cYZ_Da_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
406  MakeTextFile( ThisName, "Z vs Y, NuMu, Data Only" );
407 
408  // Now draw nue canvas with data only.
409  TCanvas* cYZ_Da_nue = new TCanvas("cYZ_Data_nue","");
410  hYZ->Draw();
411  gYvsZ_Core -> Draw("same P");
412  gYvsZ_Peri -> Draw("same P");
413  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
414  Preliminary();
415  if (IsFHC) CornerLabel("Neutrino beam");
416  else CornerLabel("Antineutrino beam");
417  ThisName = PlotDir+cYZ_Da_nue->GetName()+"_"+sFHC;
418  cYZ_Da_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
419  MakeTextFile( ThisName, "Z vs Y, Nue, Data Only" );
420 
421  // Now draw nue canvas with Core data only.
422  TCanvas* cYZ_Da_Core = new TCanvas("cYZ_Data_Core","");
423  hYZ->Draw();
424  gYvsZ_Core -> Draw("same P");
425  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
426  Preliminary();
427  if (IsFHC) CornerLabel("Neutrino beam");
428  else CornerLabel("Antineutrino beam");
429  ThisName = PlotDir+cYZ_Da_Core->GetName()+"_"+sFHC;
430  cYZ_Da_Core -> SaveAs( TString(ThisName)+TString(".pdf") );
431  MakeTextFile( ThisName, "Z vs Y, Nue Core Only, Data Only" );
432 
433  // Now draw nue canvas with Peripheral data only.
434  TCanvas* cYZ_Da_Peri = new TCanvas("cYZ_Data_Peri","");
435  hYZ->Draw();
436  gYvsZ_Peri -> Draw("same P");
437  YvsZ_L1 -> Draw(); YvsZ_L2->Draw(); YvsZ_L3->Draw(); YvsZ_L4->Draw();
438  Preliminary();
439  if (IsFHC) CornerLabel("Neutrino beam");
440  else CornerLabel("Antineutrino beam");
441  ThisName = PlotDir+cYZ_Da_Peri->GetName()+"_"+sFHC;
442  cYZ_Da_Peri -> SaveAs( TString(ThisName)+TString(".pdf") );
443  MakeTextFile( ThisName, "Z vs Y, Nue Peripheral Only, Data Only" );
444 
445  // And the numu Monte Carlo background.
446  TCanvas* cYZ_MC_numu = new TCanvas("cYZ_Mont_numu","");
447  cYZ_MC_numu -> SetRightMargin (.15);
448  hYvsZ_MC_numu -> Draw("COLZ");
449  gYvsZ_numu -> Draw("same P");
450  Preliminary();
451  if (IsFHC) CornerLabel("Neutrino beam");
452  else CornerLabel("Antineutrino beam");
453  ThisName = PlotDir+cYZ_MC_numu->GetName()+"_"+sFHC;
454  cYZ_MC_numu -> SaveAs( TString(ThisName)+TString(".pdf") );
455  MakeTextFile( ThisName, "Z vs Y, NuMu, MC vs Data" );
456 
457  // And the nue Monte Carlo background.
458  TCanvas* cYZ_MC_nue = new TCanvas("cYZ_Mont_nue","");
459  cYZ_MC_nue -> SetRightMargin (.15);
460  hYvsZ_MC_Core -> Draw("COLZ");
461  gYvsZ_Core -> Draw("same P");
462  gYvsZ_Peri -> Draw("same P");
463  Preliminary();
464  if (IsFHC) CornerLabel("Neutrino beam");
465  else CornerLabel("Antineutrino beam");
466  ThisName = PlotDir+cYZ_MC_nue->GetName()+"_"+sFHC;
467  cYZ_MC_nue -> SaveAs( TString(ThisName)+TString(".pdf") );
468  MakeTextFile( ThisName, "Z vs Y, Nue, MC vs Data" );
469 
470  return;
471 }
void FD_Data_PosComp(bool IsFHC=true)
tree Draw("slc.nhit")
void FixMCHist(TH2 *hist, std::string type)
enum BeamMode kRed
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
_Var< T > Var2D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb)
Variable formed from two input variables.
Definition: Var.cxx:247
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;})
Template for Var and SpillVar.
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:68
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
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
Definition: UtilsExt.cxx:115
T asin(T number)
Definition: d0nt_math.hpp:60
const Var kXSecCVWgt2020
Definition: XsecTunes.h:105
enum BeamMode string