TrivialBkgdEstimator.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include "TDirectory.h"
6 
7 namespace ana
8 {
9  /// Just return the MC prediction for the background
11  {
12  public:
14  const HistAxis &axis,
15  const Cut &sel,
16  std::vector<Cut> trueBkgds,
17  const SystShifts &shift = kNoShift,
18  const Var &wei = kUnweighted)
19  {
20  for (int i = 0; i < int(trueBkgds.size()); i++)
21  fMCBkgd.push_back(new Spectrum(lMC, axis, sel && trueBkgds[i],
22  shift,wei));
23  }
24  Spectrum Background() const override;
25  const Spectrum * GetComponent(int) const;
26  int GetNComponents() const;
27  void SaveTo(TDirectory *dir, const std::string& name) const override;
28  static std::unique_ptr<TrivialBkgdEstimator>LoadFrom(TDirectory *dir, const std::string& name);
32  private:
33  TrivialBkgdEstimator(std::vector<Spectrum*> mcbkgd)
34  : fMCBkgd(mcbkgd)
35  {}
36 
37  std::vector<Spectrum*> fMCBkgd;
38  };
39 }
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:33
const Spectrum * GetComponent(int) const
Spectrum Background() const override
TrivialBkgdEstimator & operator=(const TrivialBkgdEstimator &rhs)
TrivialBkgdEstimator(std::vector< Spectrum * > mcbkgd)
const SystShifts kNoShift
Definition: SystShifts.h:115
Base class for the various types of spectrum loader.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
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:100
Just return the MC prediction for the background.
std::vector< Spectrum * > fMCBkgd
void SaveTo(TDirectory *dir, const std::string &name) const override