CombineHarvester
Parameter.h
Go to the documentation of this file.
1 #ifndef CombineTools_Parameter_h
2 #define CombineTools_Parameter_h
3 #include <memory>
4 #include <string>
5 #include <vector>
6 #include "TH1.h"
7 #include "RooRealVar.h"
9 
10 namespace ch {
11 
12 class Parameter {
13  public:
14  Parameter();
15  ~Parameter();
16  Parameter(Parameter const& other);
17  Parameter(Parameter&& other);
19 
20  void set_name(std::string const& name) { name_ = name; }
21  std::string const& name() const { return name_; }
22 
23  void set_val(double const& val) {
24  if (frozen_) return;
25  val_ = val;
26  for (unsigned i = 0; i < vars_.size(); ++i) {
27  vars_[i]->setVal(val);
28  }
29  }
30 
31  double val() const { return val_; }
32 
33  void set_err_u(double const& err_u) { err_u_ = err_u; }
34  double err_u() const { return err_u_; }
35 
36  void set_err_d(double const& err_d) { err_d_ = err_d; }
37  double err_d() const { return err_d_; }
38 
39  void set_range_u(double const& range_u) { range_u_ = range_u; }
40  double range_u() const { return range_u_; }
41 
42  void set_range_d(double const& range_d) { range_d_ = range_d; }
43  double range_d() const { return range_d_; }
44 
45  void set_range(double const& range_d, double const& range_u) {
48  }
49 
50  void set_frozen(bool const& frozen) { frozen_ = frozen; }
51  bool frozen() const { return frozen_; }
52 
53  std::vector<RooRealVar *> & vars() { return vars_; }
54  std::set<std::string> & groups() { return groups_; }
55 
56  friend std::ostream& operator<< (std::ostream &out, Parameter &val);
57  static std::ostream& PrintHeader(std::ostream &out);
58 
59  private:
60  std::string name_;
61  double val_;
62  double err_u_;
63  double err_d_;
64  double range_u_;
65  double range_d_;
66  bool frozen_;
67  std::vector<RooRealVar *> vars_;
68  std::set<std::string> groups_;
69  friend void swap(Parameter& first, Parameter& second);
70 };
71 }
72 
73 #endif
void set_frozen(bool const &frozen)
Definition: Parameter.h:50
double err_u() const
Definition: Parameter.h:34
bool frozen() const
Definition: Parameter.h:51
std::set< std::string > & groups()
Definition: Parameter.h:54
void set_err_u(double const &err_u)
Definition: Parameter.h:33
void set_err_d(double const &err_d)
Definition: Parameter.h:36
double err_d() const
Definition: Parameter.h:37
friend std::ostream & operator<<(std::ostream &out, Parameter &val)
Definition: Parameter.cc:73
void set_name(std::string const &name)
Definition: Parameter.h:20
std::vector< RooRealVar * > & vars()
Definition: Parameter.h:53
static std::ostream & PrintHeader(std::ostream &out)
Definition: Parameter.cc:62
void set_range(double const &range_d, double const &range_u)
Definition: Parameter.h:45
void set_range_u(double const &range_u)
Definition: Parameter.h:39
void set_val(double const &val)
Definition: Parameter.h:23
friend void swap(Parameter &first, Parameter &second)
Definition: Parameter.cc:21
std::string const & name() const
Definition: Parameter.h:21
void set_range_d(double const &range_d)
Definition: Parameter.h:42
double range_d() const
Definition: Parameter.h:43
double range_u() const
Definition: Parameter.h:40
double val() const
Definition: Parameter.h:31
Parameter & operator=(Parameter other)
Definition: Parameter.cc:57
Definition: Algorithm.h:10