demo2p5b.C
Go to the documentation of this file.
1 // Example of how to read spectra saved to disk in and make
2 // pretty plots...
3 //
4 // This is the second half of the demo2p5a script...
5 
6 #include "TCanvas.h"
7 #include "TFile.h"
8 #include "TH1.h"
9 
10 #include "CAFAna/Core/Spectrum.h"
11 
12 
13 
14 using namespace ana;
15 
16 
17 
18 void demo2p5b(){
19 
20  TFile inFile("save_your_spectra_to_disk.root");
21 
22  // Load the spectrum...
23  std::unique_ptr<Spectrum> nhit = Spectrum::LoadFrom(inFile.GetDirectory("dir_nhit_spectra"));
24 
25 
26 
27  //
28  // Plot the histo...
29  //
30  TCanvas *cNHit = new TCanvas("cNHit","Slice NHit",1000,800);
31  cNHit->cd();
32  TH1D *hNHit = nhit->ToTH1(nhit->POT());
33  hNHit->SetLineWidth(2);
34  hNHit->SetLineColor(kGreen+2);
35  hNHit->Draw("hist");
36 
37 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
nhit
Definition: demo1.py:25
ifstream inFile
Definition: AnaPlotMaker.h:34
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
void demo2p5b()
Definition: demo2p5b.C:18
enum BeamMode kGreen