11 #include "CAFAna/Core/Binning.h" 14 #include "CAFAna/Core/Var.h" 26 #include "TAttMarker.h" 54 std::string Cap =
"Plot showing the distribution of NuMi data events passing the NuMu FD selection in the "+Plane+
" plane, with "+Overlay;
67 gROOT->SetStyle(
"novaStyle");
71 std::string AllData =
"prod4_sumrestricteddecaf_fd_numi_fhc_full_goodruns_numu2018";
72 std::string AllMC =
"prod_sumdecaf_R17-11-14-prod4reco.d_fd_genie_nonswap_fhc_nova_v08_full_v1_numu2018_str5";
76 AllData =
"prod4_sumrestricteddecaf_fd_numi_rhc_full_goodruns_numu2018";
77 AllMC =
"prod_sumdecaf_R17-11-14-prod4reco.e_fd_genie_nonswap_rhc_nova_v08_full_v1_numu2018_str5";
106 TH2* hXvsY_MC = XvsY_MC ->
ToTH2(MyPOT);
107 hXvsY_MC->GetXaxis()->SetTitle(
"Vertex X position (m)");
108 hXvsY_MC->GetYaxis()->SetTitle(
"Vertex Y position (m)");
109 hXvsY_MC->GetYaxis()->SetTitleOffset(0.7);
110 hXvsY_MC->GetZaxis()->SetTitle(
"Arbitrary units");
114 gXvsY->SetMarkerStyle(20);
115 gXvsY->SetMarkerSize(2.5);
116 gXvsY->GetXaxis()->SetTitle(
"Vertex X position (m)");
117 gXvsY->GetXaxis()->CenterTitle();
118 gXvsY->GetYaxis()->SetTitle(
"Vertex Y position (m)");
119 gXvsY->GetYaxis()->SetTitleOffset(0.7);
120 gXvsY->GetYaxis()->CenterTitle();
123 TCanvas* cXvsY =
new TCanvas(
"cXvsY",
"X pos vs Y pos no MC", 900, 800);
127 TLine *XvsY_L1 =
new TLine( -8, -8, -8, 7 ); XvsY_L1->SetLineColor(
kRed); XvsY_L1->SetLineWidth(4); XvsY_L1->SetLineStyle(2); XvsY_L1->Draw(
"same");
128 TLine *XvsY_L2 =
new TLine( 8, -8, 8, 7 ); XvsY_L2->SetLineColor(
kRed); XvsY_L2->SetLineWidth(4); XvsY_L2->SetLineStyle(2); XvsY_L2->Draw(
"same");
129 TLine *XvsY_L3 =
new TLine( -8, -8, 8, -8 ); XvsY_L3->SetLineColor(
kRed); XvsY_L3->SetLineWidth(4); XvsY_L3->SetLineStyle(2); XvsY_L3->Draw(
"same");
130 TLine *XvsY_L4 =
new TLine( -8, 7, 8, 7 ); XvsY_L4->SetLineColor(
kRed); XvsY_L4->SetLineWidth(4); XvsY_L4->SetLineStyle(2); XvsY_L4->Draw(
"same");
131 gXvsY ->
GetXaxis()->SetRangeUser(-10, 10);
132 gXvsY ->
GetYaxis()->SetRangeUser(-10, 10);
133 cXvsY ->
SaveAs( TString(
PlotDir)+TString(
"XvsY_noMCOverlay.pdf") );
137 double max1 = hXvsY_MC->GetBinContent(hXvsY_MC->GetMaximumBin());
138 hXvsY_MC->Scale(1./max1);
140 hXvsY_MC->GetXaxis()->SetRangeUser(-8, 8);
141 hXvsY_MC->GetYaxis()->SetRangeUser(-8, 7);
143 TCanvas* cXvsY_MC =
new TCanvas(
"cXvsY_MC",
"X pos vs Y pos MC Overlay", 900, 800);
144 cXvsY_MC -> SetRightMargin (.15);
145 hXvsY_MC ->
Draw(
"COLZ");
148 cXvsY_MC ->
SaveAs( TString(
PlotDir)+TString(
"XvsY_MCOverlay.pdf") );
152 TH2* hZvsY_MC = ZvsY_MC->
ToTH2(MyPOT);
153 hZvsY_MC->GetYaxis()->SetTitle(
"Vertex Y position (m)");
154 hZvsY_MC->GetYaxis()->SetTitleOffset(0.5);
155 hZvsY_MC->GetXaxis()->SetTitle(
"Vertex Z position (m)");
156 hZvsY_MC->GetZaxis()->SetTitle(
"Arbitrary units");
160 gZvsY->SetMarkerStyle(20);
161 gZvsY->SetMarkerSize(2.5);
162 gZvsY->GetXaxis()->SetTitle(
"Vertex Z position (m)");
163 gZvsY->GetXaxis()->CenterTitle();
164 gZvsY->GetYaxis()->SetTitle(
"Vertex Y position (m)");
165 gZvsY->GetYaxis()->SetTitleOffset(0.5);
166 gZvsY->GetYaxis()->CenterTitle();
169 TCanvas* cZvsY =
new TCanvas(
"cZvsY",
"Z pos vs Y pos no MC", 2500, 800);
173 TLine *ZvsY_L1 =
new TLine( 0, -8, 0 , 7 ); ZvsY_L1->SetLineColor(
kRed); ZvsY_L1->SetLineWidth(4); ZvsY_L1->SetLineStyle(2); ZvsY_L1->Draw(
"same");
174 TLine *ZvsY_L2 =
new TLine( 58, -8, 58, 7 ); ZvsY_L2->SetLineColor(
kRed); ZvsY_L2->SetLineWidth(4); ZvsY_L2->SetLineStyle(2); ZvsY_L2->Draw(
"same");
175 TLine *ZvsY_L3 =
new TLine( 0, -8, 58, -8 ); ZvsY_L3->SetLineColor(
kRed); ZvsY_L3->SetLineWidth(4); ZvsY_L3->SetLineStyle(2); ZvsY_L3->Draw(
"same");
176 TLine *ZvsY_L4 =
new TLine( 0, 7, 58, 7 ); ZvsY_L4->SetLineColor(
kRed); ZvsY_L4->SetLineWidth(4); ZvsY_L4->SetLineStyle(2); ZvsY_L4->Draw(
"same");
177 gZvsY ->
GetXaxis()->SetRangeUser( -5 , 60 );
178 gZvsY ->
GetYaxis()->SetRangeUser( -10, 10 );
179 cZvsY ->
SaveAs( TString(
PlotDir)+TString(
"ZvsY_noMCOverlay.pdf") );
183 double max2 = hZvsY_MC->GetBinContent(hZvsY_MC->GetMaximumBin());
184 hZvsY_MC->Scale(1./max2);
186 hZvsY_MC->GetXaxis()->SetRangeUser( 0 , 58 );
187 hZvsY_MC->GetYaxis()->SetRangeUser( -8, 7 );
189 TCanvas* cZvsY_MC =
new TCanvas(
"cZvsY_MC",
"Z pos vs Y pos MC Overlay", 2500, 800);
190 cZvsY_MC -> SetRightMargin (.15);
191 hZvsY_MC ->
Draw(
"COLZ");
194 cZvsY_MC ->
SaveAs( TString(
PlotDir)+TString(
"ZvsY_MCOverlay.pdf") );
198 TH2* hZvsX_MC = ZvsX_MC->
ToTH2(MyPOT);
199 hZvsX_MC->GetXaxis()->SetTitle(
"Vertex Z position (m)");
200 hZvsX_MC->GetYaxis()->SetTitle(
"Vertex X position (m)");
201 hZvsX_MC->GetYaxis()->SetTitleOffset(0.5);
202 hZvsX_MC->GetZaxis()->SetTitle(
"Arbitrary units");
206 gZvsX->SetMarkerStyle(20);
207 gZvsX->SetMarkerSize(2.5);
208 gZvsX->GetXaxis()->SetTitle(
"Vertex Z position (m)");
209 gZvsX->GetXaxis()->CenterTitle();
210 gZvsX->GetYaxis()->SetTitle(
"Vertex X position (m)");
211 gZvsX->GetYaxis()->SetTitleOffset(0.5);
214 TCanvas* cZvsX =
new TCanvas(
"cZvsX",
"Z pos vs X pos no MC", 2500, 800);
218 TLine *ZvsX_L1 =
new TLine( 0, -8, 0 , 8 ); ZvsX_L1->SetLineColor(
kRed); ZvsX_L1->SetLineWidth(4); ZvsX_L1->SetLineStyle(2); ZvsX_L1->Draw(
"same");
219 TLine *ZvsX_L2 =
new TLine( 58, -8, 58, 8 ); ZvsX_L2->SetLineColor(
kRed); ZvsX_L2->SetLineWidth(4); ZvsX_L2->SetLineStyle(2); ZvsX_L2->Draw(
"same");
220 TLine *ZvsX_L3 =
new TLine( 0, -8, 58, -8 ); ZvsX_L3->SetLineColor(
kRed); ZvsX_L3->SetLineWidth(4); ZvsX_L3->SetLineStyle(2); ZvsX_L3->Draw(
"same");
221 TLine *ZvsX_L4 =
new TLine( 0, 8, 58, 8 ); ZvsX_L4->SetLineColor(
kRed); ZvsX_L4->SetLineWidth(4); ZvsX_L4->SetLineStyle(2); ZvsX_L4->Draw(
"same");
222 gZvsX ->
GetXaxis()->SetRangeUser( -5 , 60 );
223 gZvsX ->
GetYaxis()->SetRangeUser( -10, 10 );
224 cZvsX ->
SaveAs( TString(
PlotDir)+TString(
"ZvsX_noMCOverlay.pdf") );
228 double max3 = hZvsX_MC->GetBinContent(hZvsX_MC->GetMaximumBin());
229 hZvsX_MC->Scale(1./max3);
231 hZvsX_MC->GetXaxis()->SetRangeUser( 0 , 58 );
232 hZvsX_MC->GetYaxis()->SetRangeUser( -8, 7 );
234 TCanvas* cZvsX_MC =
new TCanvas(
"cZvsX_MC",
"Z pos vs X pos MC Overlay", 2500, 800);
235 cZvsX_MC -> SetRightMargin (.15);
236 hZvsX_MC ->
Draw(
"COLZ");
239 cZvsX_MC ->
SaveAs( TString(
PlotDir)+TString(
"ZvsX_MCOverlay.pdf") );
244 TFile *
OutFile =
new TFile(OutName.c_str(),
"RECREATE");
247 gXvsY ->
Write(
"gXvsY" );
248 hXvsY_MC ->
Write(
"hXvsY_MC");
249 cXvsY_MC ->
Write(
"cXvsY_MC");
250 cXvsY ->
Write(
"cXvsY" );
252 gZvsY ->
Write(
"gZvsY" );
253 hZvsY_MC ->
Write(
"hZvsY_MC");
254 cZvsY_MC ->
Write(
"cZvsY_MC");
255 cZvsY ->
Write(
"cZvsY" );
257 gZvsX ->
Write(
"gZvsX" );
258 hZvsX_MC ->
Write(
"hZvsX_MC");
259 cZvsX_MC ->
Write(
"cZvsX_MC");
260 cZvsX ->
Write(
"cZvsX" );
void FD_Data_PosComp(bool IsFHC=true)
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Represent the binning of a Spectrum's x-axis.
Cuts and Vars for the 2020 FD DiF Study.
correl_xv GetYaxis() -> SetDecimals()
void MakeTextFile(std::string Plane, std::string Overlay)
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;})
void SetSpillCut(const SpillCut &cut)
void CenterTitles(TH1 *histo)
Representation of a spectrum in any variable, with associated POT.
const double kAna2018RHCPOT
correl_xv GetXaxis() -> SetDecimals()
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;})
virtual void Go() override
Load all the registered spectra.
std::vector< float > Spectrum
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;})
const SystShifts kNoShift
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
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?
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
const double kAna2018FHCPOT
cosmicTree SaveAs("cosmicTree.root")
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
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.
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.