MarlinUtil  1.12.1
ClusterImplWithAttributes.h
1 
2 #ifndef CLUSTERIMPLWITHATTRIBUTES_H
3 #define CLUSTERIMPLWITHATTRIBUTES_H 1
4 
5 
6 #include <vector>
7 #include <IMPL/ClusterImpl.h>
8 #include "LCGeometryTypes.h"
9 
10 
11 // FIXME: put the implementations into a *.cc file 060906 OW
12 
13 
15 
16  public:
17 
19 
20  _clusterImpl = new ClusterImpl();
21 
22  _pos = new double[3];
23 
24  _posEndHit = new double[3];
25  _posStartHit = new double[3];
26 
27  _directionEndHit = new double[3];
28  _directionStartHit = new double[3];
29  };
30 
32 
33  delete _clusterImpl;
34  _clusterImpl = 0;
35 
36  delete[] _pos;
37  _pos = 0;
38 
39  delete[] _posEndHit;
40  _posEndHit = 0;
41  delete[] _posStartHit;
42  _posStartHit = 0;
43 
44  delete[] _directionEndHit;
45  _directionEndHit = 0;
46  delete[] _directionStartHit;
47  _directionStartHit = 0;
48  };
49 
50 
51  void setPositionEndHit(double* posEndHit) { for (unsigned int i = 0; i < 3; ++i) _posEndHit[i] = posEndHit[i]; };
52  void setPositionEndHitVec(std::vector<double> posEndHit) { for (unsigned int i = 0; i < 3; ++i) _posEndHit[i] = posEndHit.at(i); };
53  void setPositionEndHitLCVec(LCVector3D posEndHit) { for (unsigned int i = 0; i < 3; ++i) _posEndHit[i] = posEndHit[i]; };
54 
55  void setPositionStartHit(double* posStartHit) { for (unsigned int i = 0; i < 3; ++i) _posStartHit[i] = posStartHit[i]; };
56  void setPositionStartHitVec(std::vector<double> posStartHit) { for (unsigned int i = 0; i < 3; ++i) _posStartHit[i] = posStartHit.at(i); };
57  void setPositionStartHitLCVec(LCVector3D posStartHit) { for (unsigned int i = 0; i < 3; ++i) _posStartHit[i] = posStartHit[i]; };
58 
59  void setPosition(double* position) {
60  float* pos = new float[3];
61  for (unsigned int i = 0; i < 3; ++i) pos[i] = (float)(position[i]);
62  _clusterImpl->setPosition(pos);
63  delete[] pos;
64  pos = 0;
65 
66  };
67 
68  void setPositionVec(std::vector<double> position) {
69  float* pos = new float[3];
70  for (unsigned int i = 0; i < 3; ++i) pos[i] = (float)position.at(i);
71  _clusterImpl->setPosition(pos);
72  delete[] pos;
73  pos = 0;
74 
75  };
76 
77  void setPositionLCVec(LCVector3D position) {
78  float* pos = new float[3];
79  for (unsigned int i = 0; i < 3; ++i) pos[i] = (float)position[i];
80  _clusterImpl->setPosition(pos);
81  delete[] pos;
82  pos = 0;
83 
84  };
85 
86  void setEnergy(double energy) {_clusterImpl->setEnergy((float)energy); };
87 
88  void setDirectionEndHit(double* directionEndHit) { for (unsigned int i = 0; i < 3; ++i) _directionEndHit[i] = directionEndHit[i]; };
89  void setDirectionEndHitVec(std::vector<double> directionEndHit) { for (unsigned int i = 0; i < 3; ++i) _directionEndHit[i] = directionEndHit.at(i); };
90  void setDirectionEndHitLCVec(LCVector3D directionEndHit) { for (unsigned int i = 0; i < 3; ++i) _directionEndHit[i] = directionEndHit[i]; };
91 
92  void setDirectionStartHit(double* directionStartHit) { for (unsigned int i = 0; i < 3; ++i) _directionStartHit[i] = directionStartHit[i]; };
93  void setDirectionStartHitVec(std::vector<double> directionStartHit) { for (unsigned int i = 0; i < 3; ++i) _directionStartHit[i] = directionStartHit.at(i); };
94  void setDirectionStartHitLCVec(LCVector3D directionStartHit) { for (unsigned int i = 0; i < 3; ++i) _directionStartHit[i] = directionStartHit[i]; };
95 
96  void setTypeEndHit(int typeEndHit) { _typeEndHit = typeEndHit; };
97  void setTypeStartHit(int typeStartHit) { _typeStartHit = typeStartHit; };
98 
99  void setIsMIPStub(bool isMIPStub) { _isMIPStub = isMIPStub; };
100  void setIsMuon(bool isMuon) { _isMuon = isMuon; };
101 
102  void setClusterImpl(ClusterImpl* clusterImpl) { _clusterImpl = clusterImpl; };
103 
104 
105  const double* getPositionEndHit() { return _posEndHit; };
106  const std::vector<double> getPositionEndHitVec() {
107  std::vector<double> posEndHit;
108  for (unsigned int i = 0; i < 3; ++i) posEndHit.push_back(_posEndHit[i]);
109  return posEndHit;
110  };
111  const LCVector3D getPositionEndHitLCVec() {
112  LCVector3D posEndHit(_posEndHit[0],_posEndHit[1],_posEndHit[2]);
113  return posEndHit;
114  };
115 
116  const double* getPositionStartHit() { return _posStartHit; };
117  const std::vector<double> getPositionStartHitVec() {
118  std::vector<double> posStartHit;
119  for (unsigned int i = 0; i < 3; ++i) posStartHit.push_back(_posStartHit[i]);
120  return posStartHit;
121  };
122  const LCVector3D getPositionStartHitLCVec() {
123  LCVector3D posStartHit(_posStartHit[0],_posStartHit[1],_posStartHit[2]);
124  return posStartHit;
125  };
126 
127  const double* getPosition() {
128  for (unsigned int i = 0; i < 3; ++i) _pos[i] = (double)(_clusterImpl->getPosition()[i]);
129  return _pos;
130  };
131  const std::vector<double> getPositionVec() {
132  std::vector<double> position;
133  for (unsigned int i = 0; i < 3; ++i) position.push_back((double)(_clusterImpl->getPosition()[i]));
134  return position;
135  };
136  const LCVector3D getPositionLCVec() {
137  LCVector3D position((double)(_clusterImpl->getPosition()[0]),(double)(_clusterImpl->getPosition()[1]),(double)(_clusterImpl->getPosition()[2]));
138  return position;
139  };
140 
141  float getEnergy() {return _clusterImpl->getEnergy();};
142 
143  const double* getDirectionEndHit() { return _directionEndHit; };
144  const std::vector<double> getDirectionEndHitVec() {
145  std::vector<double> directionEndHit;
146  for (unsigned int i = 0; i < 3; ++i) directionEndHit.push_back(_directionEndHit[i]);
147  return directionEndHit;
148  };
149  const LCVector3D getDirectionEndHitLCVec() {
150  LCVector3D directionEndHit(_directionEndHit[0],_directionEndHit[1],_directionEndHit[2]);
151  return directionEndHit;
152  };
153 
154  const double* getDirectionStartHit() { return _directionStartHit; };
155  const std::vector<double> getDirectionStartHitVec() {
156  std::vector<double> directionStartHit;
157  for (unsigned int i = 0; i < 3; ++i) directionStartHit.push_back(_directionStartHit[i]);
158  return directionStartHit;
159  };
160  const LCVector3D getDirectionStartHitLCVec() {
161  LCVector3D directionStartHit(_directionStartHit[0],_directionStartHit[1],_directionStartHit[2]);
162  return directionStartHit;
163  };
164 
165  int getTypeEndHit() { return _typeEndHit; };
166  int getTypeStartHit() { return _typeStartHit; };
167 
168  bool isMIPStub() { return _isMIPStub; };
169  bool isMuon() { return _isMuon; };
170 
171  ClusterImpl* getClusterImpl() { return _clusterImpl; };
172  void addHit(CalorimeterHit* hit, double contribution) { _clusterImpl->addHit(hit,(float)contribution); };
173 
174 
175 
176  private:
177 
178  ClusterImpl* _clusterImpl;
179 
180  double* _pos;
181  double* _posEndHit;
182  double* _posStartHit;
183 
184  double* _directionEndHit;
185  double* _directionStartHit;
186 
187  int _typeEndHit;
188  int _typeStartHit;
189 
190  bool _isMIPStub;
191  bool _isMuon;
192 
193 } ;
194 
195 
196 #endif
Definition: ClusterImplWithAttributes.h:14