7 #include "cheprep/DefaultHepRepPoint.h"
18 DefaultHepRepPoint::DefaultHepRepPoint(HepRepInstance* inst,
double xx,
double yy,
double zz)
19 : DefaultHepRepAttribute(),
instance(inst), x(xx), y(yy),
z(zz) {
22 cerr <<
"HepRepPoints cannot be created without a HepRepInstance." << endl;
28 DefaultHepRepPoint::~DefaultHepRepPoint() {
31 HepRepInstance* DefaultHepRepPoint::getInstance() {
35 HepRepAttValue* DefaultHepRepPoint::getAttValue(
string lowerCaseName) {
36 HepRepAttValue* value = getAttValueFromNode(lowerCaseName);
37 return (value != NULL) ? value :
instance->getAttValue(lowerCaseName);
41 return new DefaultHepRepPoint(inst, x, y,
z);
44 double DefaultHepRepPoint::getX() {
48 double DefaultHepRepPoint::getY() {
52 double DefaultHepRepPoint::getZ() {
56 vector<double>* DefaultHepRepPoint::getXYZ(vector<double>* xyz) {
63 double DefaultHepRepPoint::getRho() {
64 return sqrt(x*x + y*y);
67 double DefaultHepRepPoint::getPhi() {
71 double DefaultHepRepPoint::getTheta() {
72 return atan2(getRho(),
z);
75 double DefaultHepRepPoint::getR() {
77 return sqrt(r*r +
z*
z);
80 double DefaultHepRepPoint::getEta() {
81 double ct = cos(getTheta());
82 return -0.5*log((1.-ct)/(1.+ct));
85 double DefaultHepRepPoint::getX(
double xVertex,
double,
double) {
89 double DefaultHepRepPoint::getY(
double,
double yVertex,
double) {
93 double DefaultHepRepPoint::getZ(
double,
double,
double zVertex) {
97 double DefaultHepRepPoint::getRho(
double xVertex,
double yVertex,
double zVertex) {
98 double dx = getX(xVertex, yVertex, zVertex);
99 double dy = getY(xVertex, yVertex, zVertex);
100 return sqrt(dx*dx + dy*dy);
103 double DefaultHepRepPoint::getPhi(
double xVertex,
double yVertex,
double zVertex) {
104 return atan2(getY(xVertex, yVertex, zVertex), getX(xVertex, yVertex, zVertex));
107 double DefaultHepRepPoint::getTheta(
double xVertex,
double yVertex,
double zVertex) {
108 return atan2(getRho(xVertex, yVertex, zVertex), getZ(xVertex, yVertex, zVertex));
111 double DefaultHepRepPoint::getR(
double xVertex,
double yVertex,
double zVertex) {
112 double dr = getRho(xVertex, yVertex, zVertex);
113 double dz = getZ(xVertex, yVertex, zVertex);
114 return sqrt(dr*dr + dz*dz);
117 double DefaultHepRepPoint::getEta(
double xVertex,
double yVertex,
double zVertex) {
118 double ct = cos(getTheta(xVertex, yVertex, zVertex));
119 return -0.5*log((1.-ct)/(1.+ct));
void copy(std::vector< T > &main, const std::vector< T > &data)
static MCTruthManager * instance