Functions
FDDataMCSystBandLoad.C File Reference
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Cuts/Cuts.h"
#include "NuXAna/Cuts/NusCuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Prediction/PredictionCombinePeriods.h"
#include "CAFAna/Prediction/PredictionGenerator.h"
#include "CAFAna/Prediction/PredictionInterp.h"
#include "NuXAna/Systs/NusSysts.h"
#include "CAFAna/Systs/Systs.h"
#include "CAFAna/Vars/HistAxes.h"
#include "NuXAna/macros/NuSLoadMacroDefs.h"
#include "NuXAna/macros/NuSSystFunctions.h"
#include "NuXAna/macros/Ana01/Ana01Data.h"
#include "TFile.h"
#include "NuXAna/Prediction/PredictionGeneratorNuX.h"
#include "NuXAna/Vars/HistAxes.h"
#include <iostream>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

void PlotSysts (IPrediction *pred, const std::vector< const ISyst * > &systs, osc::IOscCalc *calc, TDirectory *out, FILE *text, strings strs, Spectrum *sData)
 
void PlotSysts (const Spectrum &nom, const std::vector< Spectrum > &upShifts, const std::vector< Spectrum > &downShifts, TDirectory *out, FILE *text, strings strs, Spectrum *sData)
 
void PlotSysts (IPrediction *pred, const ISyst *syst, osc::IOscCalc *calc, TDirectory *out, strings strs)
 
void PlotSysts (Spectrum &nom, Spectrum &sp1, Spectrum &sm1, TDirectory *out, strings strs, bool split=true)
 
TH1 * GetHist (strings strs, int sigma)
 
void FDDataMCSystBandLoad ()
 

Function Documentation

void FDDataMCSystBandLoad ( )

Definition at line 52 of file FDDataMCSystBandLoad.C.

References calc, ana::DefaultSterileCalc(), ana::fFDMC_non, ana::fFDMC_non_3c, ana::fFDMC_swp, ana::fFDMC_swp_3c, ana::fFDMC_tau, ana::fFDMC_tau_3c, ana::fnamefardata_unblind(), ana::fnamenear_concat, ana::fnameneardata_concat, ana::getAllNusSysts(), ana::SpectrumLoader::Go(), ana::Loaders::Go(), ana::kBeam, ana::Loaders::kData, caf::kFARDET, ana::Loaders::kFluxSwap, ana::kInBeamSpill, ana::kInTimingSideband, ana::Loaders::kMC, ana::kNCAxis, ana::kNCBinsNumuCCAxis, caf::kNEARDET, ana::Loaders::kNonSwap, ana::kNoShift, ana::kNumuND, ana::kNusFD, ana::kNusND, ana::kSecondAnaEpoch3bPOT, ana::kSecondAnaEpoch3cPOT, ana::kSecondAnaEpoch3dPOT, ana::kSecondAnaPeriod1POT, ana::kSecondAnaPeriod2POT, ana::kStandardSpillCuts, ana::Loaders::kTauSwap, ana::kTuftsWeightCC, make_pair(), plot_validation_datamc::pred, ana::PredictionInterp::SaveTo(), ana::Spectrum::SaveTo(), ana::Loaders::SetLoaderFiles(), ana::Loaders::SetLoaderPath(), ana::Loaders::SetSpillCut(), ana::SpectrumLoaderBase::SetSpillCut(), systs, and tmp.

53 {
54  TH1::AddDirectory(0);
55 
56  Loaders loaders123b;
57  loaders123b.SetLoaderPath(fnamenear_concat, caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
58  loaders123b.SetLoaderFiles(fFDMC_non, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
59  loaders123b.SetLoaderFiles(fFDMC_swp, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
62 
63  Loaders loaders3c3d;
64  loaders3c3d.SetLoaderPath(fnamenear_concat, caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
65  loaders3c3d.SetLoaderPath(fFDMC_non_3c, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
66  loaders3c3d.SetLoaderPath(fFDMC_swp_3c, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
69 
70  loaders123b.SetSpillCut(kStandardSpillCuts);
71  loaders3c3d.SetSpillCut(kStandardSpillCuts);
72 
74  loaderFDdata.SetSpillCut(kStandardSpillCuts);
75 
76  // Create vector of systematics
77  std::vector<const ISyst*> systs = getAllNusSysts();
78 
82  PredictionInterp pred123b(systs, calc, gen, loaders123b);
83  PredictionInterp pred3c3d(systs, calc, gen, loaders3c3d);
84 
85  Spectrum* sCosmic = new Spectrum(loaderFDdata, kNCAxis,
87  kNoShift, kTimingSidebandWeight);
88 
89  Spectrum* sCosOOT = new Spectrum(loaderFDdata, kNCAxis,
91 
92  Spectrum* sData = new Spectrum(loaderFDdata, kNCAxis, kInBeamSpill && kNusFD);
93 
94  loaders123b.Go();
95  loaders3c3d.Go();
96  loaderFDdata.Go();
97 
98  const double pot_p1p2e3b =
102  const double pot_e3ce3d = kSecondAnaEpoch3cPOT + kSecondAnaEpoch3dPOT;
103 
104  PredictionCombinePeriods pred({std::make_pair(&pred123b, pot_p1p2e3b),
105  std::make_pair(&pred3c3d, pot_e3ce3d)});
106 
107 
108  TFile* rootF = new TFile("Ana01_FDDataMCSystBandLoad.root", "RECREATE");
109 
110  TDirectory* tmp = gDirectory;
111  TDirectory* saveDir = gDirectory;
112 
113  // Save nominal spectra
114  saveDir = rootF->mkdir("sCosmic");
115  sCosmic->SaveTo(saveDir);
116  saveDir = rootF->mkdir("sCosOOT");
117  sCosOOT->SaveTo(saveDir);
118  saveDir = rootF->mkdir("sData");
119  sData->SaveTo(saveDir);
120  saveDir = rootF->mkdir("pred123b");
121  pred123b.SaveTo(saveDir);
122  saveDir = rootF->mkdir("pred3c3d");
123  pred3c3d.SaveTo(saveDir);
124  saveDir = rootF->mkdir("pred");
125  pred.SaveTo(saveDir);
126 
127  rootF->Close();
128 }
Near Detector underground.
Definition: SREnums.h:10
Implements systematic errors by interpolation between shifted templates.
Far Detector at Ash River.
Definition: SREnums.h:11
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
const double kSecondAnaPeriod2POT
Definition: Exposures.h:74
const Cut kNusFD
Definition: NusCuts.h:46
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
const double kSecondAnaEpoch3dPOT
Definition: Exposures.h:77
const Color_t kMC
const double kSecondAnaEpoch3bPOT
Definition: Exposures.h:75
Adapt the PMNS_Sterile calculator to standard interface.
const std::vector< std::string > fFDMC_non
Float_t tmp
Definition: plot.C:36
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const double kSecondAnaPeriod1POT
Definition: Exposures.h:73
Generates extrapolated NC predictions using ProportionalDecomp.
osc::OscCalcDumb calc
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const Cut kInTimingSideband([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return(kInTimingSideband_before(sr)|| kInTimingSideband_after(sr));else return(kInTimingSideband_before(sr)|| kInTimingSideband_afterA(sr)|| kInTimingSideband_afterB(sr));}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_after.Livetime(spill));else return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_afterA.Livetime(spill)+ kInTimingSideband_afterB.Livetime(spill));}, [](const caf::SRSpillProxy *spill){return 0;})
Definition: TimingCuts.h:12
const std::string fnamenear_concat
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
std::vector< const ISyst * > getAllNusSysts()
Get a vector of all the nus group systs.
Definition: NusSysts.cxx:202
const std::string fnameneardata_concat
const std::vector< std::string > fFDMC_swp
const std::string fFDMC_non_3c
const Cut kNumuND
Definition: NumuCuts.h:55
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const HistAxis kNCAxis("Calorimetric Energy (GeV)", kNCDisappearanceEnergyBinning, kCaloE)
Axes used in Ana01 analysis by nus group.
Definition: HistAxes.h:8
std::vector< float > Spectrum
Definition: Constants.h:728
const SystShifts kNoShift
Definition: SystShifts.cxx:22
void SetLoaderFiles(const std::vector< std::string > &files, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via explicit file list.
Definition: Loaders.cxx:45
const std::string fFDMC_tau_3c
const HistAxis kNCBinsNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNCDisappearanceEnergyBinning, kCCE)
Definition: HistAxes.h:9
const Var kTuftsWeightCC
Definition: XsecTunes.h:30
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const std::vector< std::string > fFDMC_tau
const std::string fFDMC_swp_3c
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 double kSecondAnaEpoch3cPOT
Definition: Exposures.h:76
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Sum MC predictions from different periods scaled according to data POT targets.
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
const Cut kNusND
Definition: NusCuts.h:71
const std::vector< std::string > fnamefardata_unblind(MakeUnblindList())
TH1* GetHist ( strings  strs,
int  sigma 
)

Definition at line 656 of file FDDataMCSystBandAna.C.

References om::cout, allTimeWatchdog::endl, ana::strings::fComponent, ana::strings::fDet, shutoffs::filename, fin, genie::utils::style::Format(), ana::strings::fSystS, MECModelEnuComparisons::i, getGoodRuns4SAM::n, runNovaSAM::ret, and string.

Referenced by PlotSysts().

657 {
658  std::string filename = "$NOVA_ANA/steriles/Ana01/Systematics/NusSystsAna01.root";
659  TFile fin(filename.c_str(), "read");
660  if(fin.IsZombie()) {
661  std::cout << "Warning: couldn't open file." << std::endl;
662  abort();
663  }
664 
665  std::string syst = strs.fSystS;
666 
667  if(syst.compare("mcstat") && syst.compare("ndcont") && syst.compare("norm")) {
668  std::string strsigma = ((sigma == 1) ? "+1" : "-1");
669  std::string name = TString::Format("h%s_%s_%s_%s",
670  strs.fComponent.c_str(),
671  strs.fDet.c_str(),
672  strs.fSystS.c_str(),
673  strsigma.c_str()).Data();
674 
675  TH1* ret = (TH1*)fin.Get(name.c_str());
676 
677  if(!ret) {
678  std::cout << "Error: can't find necessary " << name << std::endl;
679  abort();
680  }
681 
682  return ret;
683  }
684 
685  std::string name = TString::Format("hNC_ND_Beam_0").Data();
686  TH1* ret = (TH1*)fin.Get(name.c_str());
687 
688  if(!ret) {
689  std::cout << "Error: can't find necessary " << name << std::endl;
690  abort();
691  }
692 
693  double shift = 1.;
694  double dsigma = (double)sigma;
695  std::string comp = strs.fComponent;
696  if(!comp.compare("NC") && !syst.compare("mcstat")) shift += dsigma*.020;
697  if(!comp.compare("BG") && !syst.compare("mcstat")) shift += dsigma*.048;
698  if(!comp.compare("NC") && !syst.compare("ndcont")) shift += dsigma*.010;
699  if(!comp.compare("BG") && !syst.compare("ndcont")) shift += dsigma*.006;
700  if(!comp.compare("NC") && !syst.compare("norm") ) shift += dsigma*.032;
701  if(!comp.compare("BG") && !syst.compare("norm") ) shift += dsigma*.031;
702 
703  for(int i = 0, n = ret->GetNbinsX(); i <= n+1; ++i) {
704  ret->SetBinContent(i, shift);
705  }
706 
707  return ret;
708 }
TString fin
Definition: Style.C:24
const XML_Char * name
Definition: expat.h:151
std::string fDet
Definition: PPFXHelper.h:104
std::string fComponent
Definition: PPFXHelper.h:103
string filename
Definition: shutoffs.py:106
double sigma(TH1F *hist, double percentile)
OStream cout
Definition: OStream.cxx:6
std::string fSystS
Definition: PPFXHelper.h:108
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
enum BeamMode string
void PlotSysts ( IPrediction pred,
const std::vector< const ISyst * > &  systs,
osc::IOscCalc calc,
TDirectory *  out,
FILE *  text,
strings  strs,
Spectrum sData 
)
void PlotSysts ( const Spectrum nom,
const std::vector< Spectrum > &  upShifts,
const std::vector< Spectrum > &  downShifts,
TDirectory *  out,
FILE *  text,
strings  strs,
Spectrum sData 
)
void PlotSysts ( IPrediction pred,
const ISyst syst,
osc::IOscCalc calc,
TDirectory *  out,
strings  strs 
)

Definition at line 454 of file FDDataMCSystBandAna.C.

References ana::strings::fComponent, ana::Flavors::kAll, ana::Sign::kBoth, ana::Current::kCC, ana::Current::kNC, PlotSysts(), ana::IPrediction::PredictComponent(), ana::IPrediction::PredictComponentSyst(), and ana::SystShifts::SetShift().

458 {
461 
462  std::vector<Spectrum> ups, dns;
463 
464  SystShifts shifts;
465  shifts.SetShift(syst, +1);
468  shifts.SetShift(syst, -1);
471 
472  strs.fComponent = "NC";
473  PlotSysts(nomNC, upNC, dnNC, out, strs);
474  strs.fComponent = "BG";
475  PlotSysts(nomCC, upCC, dnCC, out, strs);
476 }
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
std::string fComponent
Definition: PPFXHelper.h:103
void PlotSysts(PredictionCombinePeriods *pred, const std::vector< const ISyst * > &systs, osc::IOscCalc *calc, TDirectory *out, FILE *text, strings strs, Spectrum &sCos, const Spectrum &sOOT, Spectrum *sData)
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
Definition: IPrediction.cxx:79
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
Charged-current interactions.
Definition: IPrediction.h:39
All neutrinos, any flavor.
Definition: IPrediction.h:26
void SetShift(const ISyst *syst, double shift, bool force=false)
Definition: SystShifts.cxx:81
void PlotSysts ( Spectrum nom,
Spectrum sp1,
Spectrum sm1,
TDirectory *  out,
strings  strs,
bool  split = true 
)

Definition at line 479 of file FDDataMCSystBandAna.C.

References std::abs(), plot_validation_datamc::c, ana::CenterTitles(), ana::strings::fComponent, ana::strings::fDet, ana::strings::fSystL, ana::strings::fSystS, ana::strings::fXLabel, GetHist(), make_syst_table_plots::h, MECModelEnuComparisons::i, kBlue, kRed, ana::kSecondAnaPOT, MECModelEnuComparisons::leg, std::max(), std::min(), chisquared::minval, plotROC::nBins, scale, Simulation(), string, std::swap(), plotROC::title, and ana::Spectrum::ToTH1().

481 {
482  // Scale everything to data POT
483  double scale = kSecondAnaPOT;
484 
485  TH1* h = nom.ToTH1(scale);
486  TH1* hp1 = sp1.ToTH1(scale);
487  TH1* hm1 = sm1.ToTH1(scale);
488 
489  // Construct histogram names and titles
490  std::string xlabel = strs.fXLabel;
491  std::string ylabel = "Events / 6.05 #times 10^{20} POT";
492  std::string title = strs.fDet + " " + strs.fComponent +
493  " Error for " + strs.fSystL + " Systematic";
494  std::string fullTitle = title + ";" + xlabel + ";" + ylabel;
495  std::string name = "c" + strs.fComponent + strs.fDet + strs.fSystS;
496  std::string ylabelRat = "Shifted / Nominal";
497  std::string fullTitleRat = ";" + xlabel + ";" + ylabelRat;
498 
499  TH1* hRat = (TH1*)h->Clone();
500  TH1* hp1Rat = (TH1*)hp1->Clone();
501  TH1* hm1Rat = (TH1*)hm1->Clone();
502 
503  int nBins = h->GetNbinsX();
504  for(int i = 0; i <= nBins+1; ++i) {
505  hRat->SetBinContent(i, 1.);
506  }
507  hp1Rat->Divide(h);
508  hm1Rat->Divide(h);
509 
510  double maxval = h->GetBinContent(h->GetMaximumBin());
511  maxval = std::max(maxval, hp1->GetBinContent(hp1->GetMaximumBin()));
512  maxval = std::max(maxval, hm1->GetBinContent(hm1->GetMaximumBin()));
513 
514  double minval = h->GetBinContent(h->GetMinimumBin());
515  minval = std::min(minval, hp1->GetBinContent(hp1->GetMinimumBin()));
516  minval = std::min(minval, hm1->GetBinContent(hm1->GetMinimumBin()));
517 
518  if(maxval < minval) { std::swap(maxval, minval); }
519 
520  double maxvalRat = hRat->GetBinContent(hRat->GetMaximumBin());
521  maxvalRat = std::max(maxvalRat, hp1Rat->GetBinContent(hp1Rat->GetMaximumBin()));
522  maxvalRat = std::max(maxvalRat, hm1Rat->GetBinContent(hm1Rat->GetMaximumBin()));
523 
524  double minvalRat = hRat->GetBinContent(hRat->GetMinimumBin());
525  for(int i = 1; i <= nBins; ++i) {
526  if(hp1Rat->GetBinContent(i) > 0.) {
527  minvalRat = std::min(minvalRat, hp1Rat->GetBinContent(i));
528  }
529  if(hm1Rat->GetBinContent(i) > 0.) {
530  minvalRat = std::min(minvalRat, hm1Rat->GetBinContent(i));
531  }
532  }
533 
534  if(std::abs(maxvalRat - 1.) > std::abs(1. - minvalRat)) {
535  minvalRat = 1 - std::abs(maxvalRat - 1.);
536  maxvalRat = 1 + std::abs(maxvalRat - 1.);
537  }
538  else {
539  minvalRat = 1 - std::abs(1. - minvalRat);
540  maxvalRat = 1 + std::abs(1. - minvalRat);
541  }
542 
543  CenterTitles(h);
544  h->SetLineColor(kBlack);
545  h->SetMaximum(1.1*maxval);
546  h->SetMinimum(0);
547  h->SetTitle(fullTitle.c_str());
548 
549  CenterTitles(hp1);
550  hp1->SetLineColor(kRed);
551  hp1->SetLineStyle(2);
552  hp1->SetMaximum(1.1*maxval);
553  hp1->SetMinimum(0);
554  hp1->SetTitle(fullTitle.c_str());
555 
556  CenterTitles(hm1);
557  hm1->SetLineColor(kBlue);
558  hm1->SetLineStyle(2);
559  hm1->SetMaximum(1.1*maxval);
560  hm1->SetMinimum(0);
561  hm1->SetTitle(fullTitle.c_str());
562 
563  CenterTitles(hRat);
564  hRat->SetLineColor(kBlack);
565  hRat->SetMaximum(1.1*maxvalRat);
566  hRat->SetMinimum(0.9*minvalRat);
567  hRat->SetTitle(fullTitleRat.c_str());
568 
569  CenterTitles(hp1Rat);
570  hp1Rat->SetLineColor(kRed);
571  hp1Rat->SetLineStyle(2);
572  hp1Rat->SetMaximum(1.1*maxvalRat);
573  hp1Rat->SetMinimum(0.9*minvalRat);
574  hp1Rat->SetTitle(fullTitleRat.c_str());
575 
576  CenterTitles(hm1Rat);
577  hm1Rat->SetLineColor(kBlue);
578  hm1Rat->SetLineStyle(2);
579  hm1Rat->SetMaximum(1.1*maxvalRat);
580  hm1Rat->SetMinimum(0.9*minvalRat);
581  hm1Rat->SetTitle(fullTitleRat.c_str());
582 
583  double xL = 0.6, xR = 0.85;
584  double yB = 0.6, yT = 0.85;
585  TLegend* leg = new TLegend(xL, yB, xR, yT);
586  leg->AddEntry(h, "Nominal", "l");
587  leg->AddEntry(hp1, "+1 Sigma", "l");
588  leg->AddEntry(hm1, "-1 Sigma", "l");
589 
590  TCanvas* c = new TCanvas(name.c_str(), title.c_str(), 800, 800);
591  gPad->SetFillStyle(0);
592  TPad* pSpecs = new TPad("pSpecs", "", 0., 0.375, 1., 1.);
593  TPad* pRatio = new TPad("pRatio", "", 0., 0., 1., 0.375);
594  pSpecs->Draw();
595  pRatio->Draw();
596 
597  pSpecs->cd();
598  h->Draw("hist");
599  hp1->Draw("hist same");
600  hm1->Draw("hist same");
601  leg->Draw();
602  Simulation();
603 
604  pRatio->cd();
605  hRat->Draw("hist");
606  hp1Rat->Draw("hist same");
607  hm1Rat->Draw("hist same");
608 
609  c->Update();
610  out->WriteTObject(c);
611 
612  if(split) {
613  TH1* hp1DRat = GetHist(strs, +1);
614  TH1* hm1DRat = GetHist(strs, -1);
615 
616  hp1DRat->Divide(hp1Rat);
617  hm1DRat->Divide(hm1Rat);
618 
619  CenterTitles(hp1DRat);
620  hp1DRat->SetLineColor(kBlack);
621  hp1DRat->SetMaximum(1.1*maxvalRat);
622  hp1DRat->SetMinimum(0.9*minvalRat);
623  hp1DRat->SetTitle(fullTitle.c_str());
624 
625  CenterTitles(hp1);
626  hm1DRat->SetLineColor(kRed);
627  hm1DRat->SetLineStyle(2);
628  hm1DRat->SetMaximum(1.1*maxvalRat);
629  hm1DRat->SetMinimum(0.9*minvalRat);
630  hm1DRat->SetTitle(fullTitle.c_str());
631 
632  TLegend* leg2 = new TLegend(xL, yB, xR, yT);
633  leg2->AddEntry(hp1DRat, "+1 Sigma Double Ratio", "l");
634  leg2->AddEntry(hm1DRat, "-1 Sigma Double Ratio", "l");
635 
636  std::string titleDR = strs.fDet + " " + strs.fComponent +
637  strs.fSystL + " Double Ratio";
638  std::string nameDR = name + "DR";
639  std::string ylabelDRat = "File Ratio / Macro Ratio";
640  std::string fullTitleDRat = ";" + xlabel + ";" + ylabelDRat + titleDR;
641 
642  TCanvas* cDR = new TCanvas(nameDR.c_str(), fullTitleDRat.c_str(), 800, 500);
643  gPad->SetFillStyle(0);
644  hp1DRat->Draw("hist");
645  hm1DRat->Draw("hist same");
646  leg2->Draw();
647  Simulation();
648 
649  out->WriteTObject(cDR);
650  }
651 
652  return;
653 }
void Simulation()
Definition: tools.h:16
T max(const caf::Proxy< T > &a, T b)
void split(double tt, double *fr)
const XML_Char * name
Definition: expat.h:151
int nBins
Definition: plotROC.py:16
std::string fDet
Definition: PPFXHelper.h:104
enum BeamMode kRed
std::string fComponent
Definition: PPFXHelper.h:103
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
float abs(float number)
Definition: d0nt_math.hpp:39
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
Double_t scale
Definition: plot.C:25
void CenterTitles(TH1 *h)
std::string fSystL
Definition: PPFXHelper.h:109
std::string fXLabel
Definition: PPFXHelper.h:110
TH1 * GetHist(strings strs, int sigma)
std::string fSystS
Definition: PPFXHelper.h:108
T min(const caf::Proxy< T > &a, T b)
const double kSecondAnaPOT
Definition: Exposures.h:87
enum BeamMode kBlue
enum BeamMode string