3 #include "boost/format.hpp"
8 return boost::format(
"%-6s %-9s %-6s %-8s %-28s %-3i %-21s %-10.5g %-5i")
17 % (bool(val.
shape()) || bool(val.
data()));
36 swap(first.rate_, second.rate_);
37 swap(first.shape_, second.shape_);
38 swap(first.data_, second.data_);
47 h =
dynamic_cast<TH1*
>(other.shape_->Clone());
50 shape_ = std::unique_ptr<TH1>(h);
81 shape_ = std::move(
shape);
83 shape_->SetDirectory(0);
87 if (shape_->Integral() > 0.) shape_->Scale(1. / shape_->Integral());
95 if (!shape_)
return std::unique_ptr<TH1>();
96 std::unique_ptr<TH1> res(
static_cast<TH1 *
>(shape_->Clone()));
102 if (!shape_)
return std::unique_ptr<TH1>();
104 res->Scale(this->
rate());
110 throw std::runtime_error(
111 FNERROR(
"Observation object does not contain a shape"));
116 TH1F
const* test_f =
dynamic_cast<TH1F const*
>(this->
shape());
117 TH1D
const* test_d =
dynamic_cast<TH1D const*
>(this->
shape());
123 throw std::runtime_error(
FNERROR(
"TH1 shape is not a TH1F or a TH1D"));
130 (boost::format(
"%-6s %-9s %-6s %-8s %-28s %-3i %-21s %-10.5g %-5i")
131 %
"mass" %
"analysis" %
"era" %
"channel" %
"bin" %
"id" %
"process" %
132 "rate" %
"shape").str();
133 std::string div(line.length(),
'-');
134 out << div << std::endl;
135 out << line << std::endl;
136 out << div << std::endl;
141 return ::format_obs(*this).str();
145 out << ::format_obs(val);
virtual void set_process(std::string const &process)
virtual std::string const & bin() const
virtual int bin_id() const
virtual std::string const & analysis() const
virtual std::string const & era() const
virtual std::string const & mass() const
virtual std::string const & channel() const
void set_rate(double const &rate)
TH1 const * shape() const
std::unique_ptr< TH1 > ClonedScaledShape() const
static std::ostream & PrintHeader(std::ostream &out)
Observation & operator=(Observation other)
void set_shape(std::unique_ptr< TH1 > shape, bool set_rate)
RooAbsData const * data() const
std::string to_string() const
std::unique_ptr< TH1 > ClonedShape() const
friend void swap(Observation &first, Observation &second)
std::ostream & operator<<(std::ostream &out, HistMapping const &val)
void swap(Observation &first, Observation &second)
void swap(CombineHarvester &first, CombineHarvester &second)