CombineHarvester
Object.h
Go to the documentation of this file.
1 #ifndef CombineTools_Object_h
2 #define CombineTools_Object_h
3 #include <string>
4 #include <map>
5 
6 namespace ch {
7 
8 class Object {
9  public:
10  Object();
11  virtual ~Object();
12  Object(Object const& other);
13  Object(Object&& other);
14  Object& operator=(Object other);
15 
16  virtual void set_bin(std::string const& bin) { bin_ = bin; }
17  virtual std::string const& bin() const { return bin_; }
18 
19  virtual void set_process(std::string const& process) { process_ = process; }
20  virtual std::string const& process() const { return process_; }
21 
22  void set_signal(bool const& signal) { signal_ = signal; }
23  bool signal() const { return signal_; }
24 
25  virtual void set_analysis(std::string const& analysis) { analysis_ = analysis; }
26  virtual std::string const& analysis() const { return analysis_; }
27 
28  virtual void set_era(std::string const& era) { era_ = era; }
29  virtual std::string const& era() const { return era_; }
30 
31  virtual void set_channel(std::string const& channel) { channel_ = channel; }
32  virtual std::string const& channel() const { return channel_; }
33 
34  virtual void set_bin_id(int const& bin_id) { bin_id_ = bin_id; }
35  virtual int bin_id() const { return bin_id_; }
36 
37  virtual void set_mass(std::string const& mass) { mass_ = mass; }
38  virtual std::string const& mass() const { return mass_; }
39 
40  virtual void set_attribute(std::string const& attr_label, std::string const& attr_value);
41  virtual void delete_attribute(std::string const& attr_label) { attributes_.erase(attr_label); }
42  virtual void set_all_attributes(std::map<std::string,std::string> const& attrs_) { attributes_ = attrs_;}
43  virtual std::map<std::string,std::string> const& all_attributes() const { return attributes_;}
44  virtual std::string const attribute(std::string const& attr_label) const { return attributes_.count(attr_label) >0 ? attributes_.at(attr_label) : "" ; }
45 
46  private:
47  std::string bin_;
48  std::string process_;
49  bool signal_;
50  std::string analysis_;
51  std::string era_;
52  std::string channel_;
53  int bin_id_;
54  std::string mass_;
55  std::map<std::string,std::string> attributes_;
56  friend void swap(Object& first, Object& second);
57 };
58 }
59 
60 #endif
virtual void set_analysis(std::string const &analysis)
Definition: Object.h:25
virtual void set_process(std::string const &process)
Definition: Object.h:19
virtual std::string const attribute(std::string const &attr_label) const
Definition: Object.h:44
virtual void set_mass(std::string const &mass)
Definition: Object.h:37
virtual std::string const & process() const
Definition: Object.h:20
virtual void set_bin(std::string const &bin)
Definition: Object.h:16
virtual std::string const & bin() const
Definition: Object.h:17
virtual void set_attribute(std::string const &attr_label, std::string const &attr_value)
Definition: Object.cc:55
Object & operator=(Object other)
Definition: Object.cc:63
virtual void set_all_attributes(std::map< std::string, std::string > const &attrs_)
Definition: Object.h:42
virtual int bin_id() const
Definition: Object.h:35
friend void swap(Object &first, Object &second)
Definition: Object.cc:18
virtual std::string const & analysis() const
Definition: Object.h:26
virtual std::string const & era() const
Definition: Object.h:29
Object()
Definition: Object.cc:5
virtual std::string const & mass() const
Definition: Object.h:38
virtual ~Object()
Definition: Object.cc:16
bool signal() const
Definition: Object.h:23
virtual void set_era(std::string const &era)
Definition: Object.h:28
void set_signal(bool const &signal)
Definition: Object.h:22
virtual std::string const & channel() const
Definition: Object.h:32
virtual std::map< std::string, std::string > const & all_attributes() const
Definition: Object.h:43
virtual void set_channel(std::string const &channel)
Definition: Object.h:31
virtual void set_bin_id(int const &bin_id)
Definition: Object.h:34
virtual void delete_attribute(std::string const &attr_label)
Definition: Object.h:41
Definition: Algorithm.h:10