# TTTT Analysis: /home/caleb/Sources/TTTT/filval_root/value.hpp Source File

value.hpp
#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
fv::GenValue::name
std::string name
The name of the value.
Definition: value.hpp:190
fv::root::LorentzVector::update_value
void update_value()
Updates the internal value.
Definition: value.hpp:15
fv::root::LorentzVectorEnergy::verify_integrity
void verify_integrity()
This function serves to check that this Value has been created with real, i.e.
Definition: value.hpp:59
fv::root::LorentzVector::verify_integrity
void verify_integrity()
This function serves to check that this Value has been created with real, i.e.
Definition: value.hpp:19
fv::root::LorentzVector
Definition: value.hpp:8
fv::root::LorentzVectorEnergy
Definition: value.hpp:52
fv::Value< double >
fv::root
fv::DerivedValue
A generic, derived, value.
Definition: value.hpp:366
fv::Value::get_value
virtual T & get_value()=0
Calculate, if necessary, and return the value held by this object.
fv::root::LorentzVectorEnergy::update_value
void update_value()
Updates the internal value.
Definition: value.hpp:55