Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
DefaultHepRepPoint.cc
이 파일의 문서화 페이지로 가기
1 // Copyright FreeHEP, 2005.
2 
3 #include <string>
4 #include <iostream>
5 #include <cmath>
6 
8 
9 using namespace std;
10 using namespace HEPREP;
11 
16 namespace cheprep {
17 
18 DefaultHepRepPoint::DefaultHepRepPoint(HepRepInstance* inst, double xx, double yy, double zz)
19  : DefaultHepRepAttribute(), instance(inst), x(xx), y(yy), z(zz) {
20 
21  if (instance == NULL) {
22  cerr << "HepRepPoints cannot be created without a HepRepInstance." << endl;
23  } else {
24  instance->addPoint(this);
25  }
26 }
27 
29 }
30 
32  return instance;
33 }
34 
36  HepRepAttValue* value = getAttValueFromNode(lowerCaseName);
37  return (value != NULL) ? value : instance->getAttValue(lowerCaseName);
38 }
39 
41  return new DefaultHepRepPoint(inst, x, y, z);
42 }
43 
45  return x;
46 }
47 
49  return y;
50 }
51 
53  return z;
54 }
55 
56 vector<double>* DefaultHepRepPoint::getXYZ(vector<double>* xyz) {
57  (*xyz)[0] = x;
58  (*xyz)[1] = y;
59  (*xyz)[2] = z;
60  return xyz;
61 }
62 
64  return sqrt(x*x + y*y);
65 }
66 
68  return atan2(y, x);
69 }
70 
72  return atan2(getRho(), z);
73 }
74 
76  double r = getRho();
77  return sqrt(r*r + z*z);
78 }
79 
81  double ct = cos(getTheta());
82  return -0.5*log((1.-ct)/(1.+ct));
83 }
84 
85 double DefaultHepRepPoint::getX(double xVertex, double, double) {
86  return x - xVertex;
87 }
88 
89 double DefaultHepRepPoint::getY(double, double yVertex, double) {
90  return y - yVertex;
91 }
92 
93 double DefaultHepRepPoint::getZ(double, double, double zVertex) {
94  return z - zVertex;
95 }
96 
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);
101 }
102 
103 double DefaultHepRepPoint::getPhi(double xVertex, double yVertex, double zVertex) {
104  return atan2(getY(xVertex, yVertex, zVertex), getX(xVertex, yVertex, zVertex));
105 }
106 
107 double DefaultHepRepPoint::getTheta(double xVertex, double yVertex, double zVertex) {
108  return atan2(getRho(xVertex, yVertex, zVertex), getZ(xVertex, yVertex, zVertex));
109 }
110 
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);
115 }
116 
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));
120 }
121 
122 
123 } // cheprep
124 
Float_t x
Definition: compare.C:6
Double_t xx
virtual HepRepAttValue * getAttValue(std::string name)=0
DefaultHepRepPoint(HEPREP::HepRepInstance *instance, double x, double y, double z)
HEPREP::HepRepAttValue * getAttValueFromNode(std::string lowerCaseName)
Float_t y
Definition: compare.C:6
Double_t z
HEPREP::HepRepInstance * getInstance()
Double_t zz
HEPREP::HepRepPoint * copy(HEPREP::HepRepInstance *parent)
std::vector< double > * getXYZ(std::vector< double > *xyz)
const XML_Char int const XML_Char * value
Definition: expat.h:331
HEPREP::HepRepAttValue * getAttValue(std::string lowerCaseName)
virtual void addPoint(HepRepPoint *point)=0
static MCTruthManager * instance
HEPREP::HepRepInstance * instance