4 #include "boost/format.hpp"
10 "%-6s %-9s %-6s %-8s %-28s %-3i %-16s %-4i %-10.5g %-5i") %
14 (bool(val.
shape()) || bool(val.
pdf()) || bool(val.
data()));
29 cached_int_(nullptr) {
33 if (cached_int_)
delete cached_int_;
39 swap(first.rate_, second.rate_);
40 swap(first.shape_, second.shape_);
41 swap(first.pdf_, second.pdf_);
42 swap(first.data_, second.data_);
43 swap(first.norm_, second.norm_);
44 swap(first.cached_obs_, second.cached_obs_);
45 swap(first.cached_int_, second.cached_int_);
54 cached_obs_(other.cached_obs_),
55 cached_int_(nullptr) {
58 h =
static_cast<TH1*
>(other.shape_->Clone());
61 shape_ = std::unique_ptr<TH1>(h);
72 cached_int_(nullptr) {
96 shape_ = std::move(
shape);
98 shape_->SetDirectory(0);
102 if (shape_->Integral() > 0.) shape_->Scale(1. / shape_->Integral());
111 if (!shape_)
return std::unique_ptr<TH1>();
112 std::unique_ptr<TH1> res(
static_cast<TH1 *
>(shape_->Clone()));
113 res->SetDirectory(0);
118 if (!shape_)
return std::unique_ptr<TH1>();
125 if (!shape_ && !data_) {
126 throw std::runtime_error(
127 FNERROR(
"Process object does not contain a shape"));
133 TH1F
const* test_f =
dynamic_cast<TH1F const*
>(this->
shape());
134 TH1D
const* test_d =
dynamic_cast<TH1D const*
>(this->
shape());
140 throw std::runtime_error(
FNERROR(
"TH1 shape is not a TH1F or a TH1D"));
142 }
else if (this->
data()) {
143 std::string var_name = this->
data()->get()->first()->GetName();
144 TH1F *tmp =
dynamic_cast<TH1F*
>(this->
data()->createHistogram(
148 if (res.Integral() > 0.) res.Scale(1. / res.Integral());
156 "%-6s %-9s %-6s %-8s %-28s %-3i %-16s %-4i %-10.5g %-5i") %
157 "mass" %
"analysis" %
"era" %
"channel" %
"bin" %
"id" %
"process" %
158 "sig" %
"rate" %
"shape").str();
159 std::string div(line.length(),
'-');
160 out << div << std::endl;
161 out << line << std::endl;
162 out << div << std::endl;
167 return ::format_proc(*this).str();
171 out << ::format_proc(val);
virtual std::string const & process() const
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
double no_norm_rate() const
Get the process normalisation without multiplying by the RooAbsReal value (in the case that it's pres...
RooAbsReal const * pdf() const
void set_rate(double const &rate)
std::unique_ptr< TH1 > ClonedScaledShape() const
void set_shape(std::unique_ptr< TH1 > shape, bool set_rate)
std::string to_string() const
RooAbsData const * data() const
static std::ostream & PrintHeader(std::ostream &out)
friend void swap(Process &first, Process &second)
TH1 const * shape() const
Process & operator=(Process other)
std::unique_ptr< TH1 > ClonedShape() const
std::ostream & operator<<(std::ostream &out, HistMapping const &val)
void swap(Process &first, Process &second)
void swap(CombineHarvester &first, CombineHarvester &second)