value.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef root_value_hpp
  2. #define root_value_hpp
  3. #include "value.hpp"
  4. #include "TLorentzVector.h"
  5. namespace filval::root{
  6. class LorentzVector : public DerivedValue<TLorentzVector>{
  7. protected:
  8. Value<double> *pt;
  9. Value<double> *eta;
  10. Value<double> *phi;
  11. Value<double> *m;
  12. void update_value(){
  13. value.SetPtEtaPhiM(pt->get_value(), eta->get_value(), phi->get_value(), m->get_value());
  14. }
  15. public:
  16. LorentzVector(const std::string& name,
  17. Value<double>* pt,
  18. Value<double>* eta,
  19. Value<double>* phi,
  20. Value<double>* m)
  21. :DerivedValue<TLorentzVector>(name),
  22. pt(pt), eta(eta),
  23. phi(phi), m(m) { }
  24. LorentzVector(const std::string& name,
  25. const std::string &pt_label,
  26. const std::string &eta_label,
  27. const std::string &phi_label,
  28. const std::string &m_label)
  29. :LorentzVector(name,
  30. dynamic_cast<Value<double>*>(GenValue::get_value(pt_label)),
  31. dynamic_cast<Value<double>*>(GenValue::get_value(eta_label)),
  32. dynamic_cast<Value<double>*>(GenValue::get_value(phi_label)),
  33. dynamic_cast<Value<double>*>(GenValue::get_value(m_label))){ }
  34. };
  35. class LorentzVectorEnergy : public DerivedValue<double>{
  36. protected:
  37. Value<TLorentzVector>* vector;
  38. void update_value(){
  39. value = vector->get_value().E();
  40. }
  41. public:
  42. LorentzVectorEnergy(const std::string& name, Value<TLorentzVector>* vector)
  43. :DerivedValue<double>(name),
  44. vector(vector){ }
  45. LorentzVectorEnergy(const std::string& name, const std::string& vector_label)
  46. :LorentzVectorEnergy(name,
  47. dynamic_cast<Value<TLorentzVector>*>(GenValue::get_value(vector_label))){ }
  48. };
  49. }
  50. #endif // root_value_hpp