TrivialBkgdEstimator.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "CAFAna/Core/Var.h"
5 
6 #include "TDirectory.h"
7 
8 namespace ana
9 {
10  /// Just return the MC prediction for the background
12  {
13  public:
15  const HistAxis &axis,
16  const Cut &sel,
17  std::vector<Cut> trueBkgds,
18  const SystShifts &shift = kNoShift,
19  const Var &wei = kUnweighted)
20  {
21  for (int i = 0; i < int(trueBkgds.size()); i++)
22  fMCBkgd.push_back(new Spectrum(lMC, axis, sel && trueBkgds[i],
23  shift,wei));
24  }
25  Spectrum Background() const override;
26  const Spectrum * GetComponent(int) const;
27  int GetNComponents() const;
28  void SaveTo(TDirectory *dir, const std::string& name) const override;
29  static std::unique_ptr<TrivialBkgdEstimator>LoadFrom(TDirectory *dir, const std::string& name);
33  private:
34  TrivialBkgdEstimator(std::vector<Spectrum*> mcbkgd)
35  : fMCBkgd(mcbkgd)
36  {}
37 
38  std::vector<Spectrum*> fMCBkgd;
39  };
40 }
const XML_Char * name
Definition: expat.h:151
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
static std::unique_ptr< TrivialBkgdEstimator > LoadFrom(TDirectory *dir, const std::string &name)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Spectrum * GetComponent(int) const
Spectrum Background() const override
TrivialBkgdEstimator & operator=(const TrivialBkgdEstimator &rhs)
TrivialBkgdEstimator(std::vector< Spectrum * > mcbkgd)
const SystShifts kNoShift
Definition: SystShifts.cxx:21
Base class for the various types of spectrum loader.
TDirectory * dir
Definition: macro.C:5
TrivialBkgdEstimator(SpectrumLoaderBase &lMC, const HistAxis &axis, const Cut &sel, std::vector< Cut > trueBkgds, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:96
Just return the MC prediction for the background.
std::vector< Spectrum * > fMCBkgd
void SaveTo(TDirectory *dir, const std::string &name) const override
enum BeamMode string