TTTT Analysis  0.1
value.hpp
1 #ifndef root_value_hpp
2 #define root_value_hpp
3 #include "value.hpp"
4 #include "TLorentzVector.h"
5 
6 namespace filval::root{
7 
8 class LorentzVector : public DerivedValue<TLorentzVector>{
9  protected:
10  Value<double> *pt;
11  Value<double> *eta;
12  Value<double> *phi;
13  Value<double> *m;
14  void update_value(){
15  value.SetPtEtaPhiM(pt->get_value(), eta->get_value(), phi->get_value(), m->get_value());
16  }
17  public:
18  LorentzVector(const std::string& name,
19  Value<double>* pt,
20  Value<double>* eta,
21  Value<double>* phi,
22  Value<double>* m)
24  pt(pt), eta(eta),
25  phi(phi), m(m) { }
26 
27  LorentzVector(const std::string& name,
28  const std::string &pt_label,
29  const std::string &eta_label,
30  const std::string &phi_label,
31  const std::string &m_label)
32  :LorentzVector(name,
33  dynamic_cast<Value<double>*>(GenValue::get_value(pt_label)),
34  dynamic_cast<Value<double>*>(GenValue::get_value(eta_label)),
35  dynamic_cast<Value<double>*>(GenValue::get_value(phi_label)),
36  dynamic_cast<Value<double>*>(GenValue::get_value(m_label))){ }
37 };
38 
39 class LorentzVectorEnergy : public DerivedValue<double>{
40  protected:
41  Value<TLorentzVector>* vector;
42  void update_value(){
43  value = vector->get_value().E();
44  }
45  public:
46  LorentzVectorEnergy(const std::string& name, Value<TLorentzVector>* vector)
48  vector(vector){ }
49 
50  LorentzVectorEnergy(const std::string& name, const std::string& vector_label)
51  :LorentzVectorEnergy(name,
52  dynamic_cast<Value<TLorentzVector>*>(GenValue::get_value(vector_label))){ }
53 };
54 }
55 #endif // root_value_hpp
std::string name
The name of the value.
Definition: value.hpp:71
virtual T & get_value()=0
Calculate, if necessary, and return the value held by this object.
Definition: container.hpp:10
A generic, derived, value.
Definition: value.hpp:174
Definition: value.hpp:8
void update_value()
Updates the internal value.
Definition: value.hpp:14
Definition: value.hpp:39
void update_value()
Updates the internal value.
Definition: value.hpp:42