123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef root_value_hpp
- #define root_value_hpp
- #include "value.hpp"
- #include "TLorentzVector.h"
- namespace fv::root{
- class LorentzVector : public DerivedValue<TLorentzVector>{
- protected:
- Value<double> *pt;
- Value<double> *eta;
- Value<double> *phi;
- Value<double> *m;
- void update_value(){
- value.SetPtEtaPhiM(pt->get_value(), eta->get_value(), phi->get_value(), m->get_value());
- }
- void verify_integrity(){
- if (pt == nullptr)
- CRITICAL("LorentzVector " << this->get_name() << " created with invalid pt", -1);
- if (eta == nullptr)
- CRITICAL("LorentzVector " << this->get_name() << " created with invalid eta", -1);
- if (phi == nullptr)
- CRITICAL("LorentzVector " << this->get_name() << " created with invalid phi", -1);
- if (m == nullptr)
- CRITICAL("LorentzVector " << this->get_name() << " created with invalid mass", -1);
- }
- public:
- LorentzVector(const std::string& name,
- Value<double>* pt,
- Value<double>* eta,
- Value<double>* phi,
- Value<double>* m)
- :DerivedValue<TLorentzVector>(name),
- pt(pt), eta(eta),
- phi(phi), m(m) { }
- LorentzVector(const std::string& name,
- const std::string &pt_label,
- const std::string &eta_label,
- const std::string &phi_label,
- const std::string &m_label)
- :LorentzVector(name,
- dynamic_cast<Value<double>*>(GenValue::get_value(pt_label)),
- dynamic_cast<Value<double>*>(GenValue::get_value(eta_label)),
- dynamic_cast<Value<double>*>(GenValue::get_value(phi_label)),
- dynamic_cast<Value<double>*>(GenValue::get_value(m_label))){ }
- };
- class LorentzVectorEnergy : public DerivedValue<double>{
- protected:
- Value<TLorentzVector>* vector;
- void update_value(){
- value = vector->get_value().E();
- }
- void verify_integrity(){
- if (vector == nullptr)
- CRITICAL("LorentzVectorEnergy " << this->get_name() << " created with invalid vector", -1);
- }
- public:
- LorentzVectorEnergy(const std::string& name, Value<TLorentzVector>* vector)
- :DerivedValue<double>(name),
- vector(vector){ }
- LorentzVectorEnergy(const std::string& name, const std::string& vector_label)
- :LorentzVectorEnergy(name,
- dynamic_cast<Value<TLorentzVector>*>(GenValue::get_value(vector_label))){ }
- };
- }
- #endif // root_value_hpp
|