Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GMocrenDataPrimitive< T > Class Template Reference

#include <G4GMocrenIO.hh>

Collaboration diagram for GMocrenDataPrimitive< T >:

Public Member Functions

 GMocrenDataPrimitive ()
 
 ~GMocrenDataPrimitive ()
 
GMocrenDataPrimitive< T > & operator= (const GMocrenDataPrimitive< T > &_right)
 
GMocrenDataPrimitive< T > & operator+ (const GMocrenDataPrimitive< T > &_right)
 
GMocrenDataPrimitive< T > & operator+= (const GMocrenDataPrimitive< T > &_right)
 
void clear ()
 
void clearImage ()
 
void setSize (int _size[3])
 
void getSize (int _size[3])
 
void setScale (double &_scale)
 
double getScale ()
 
void setMinMax (T _minmax[2])
 
void getMinMax (T _minmax[2])
 
void setImage (std::vector< T * > &_image)
 
void addImage (T *_image)
 
std::vector< T * > & getImage ()
 
T * getImage (int _z)
 
void setCenterPosition (float _center[3])
 
void getCenterPosition (float _center[3])
 
void setName (std::string &_name)
 
std::string getName ()
 

Protected Attributes

int kSize [3]
 
double kScale
 
kMinmax [2]
 
float kCenter [3]
 
std::vector< T * > kImage
 
std::string kDataName
 

Detailed Description

template<typename T>
class GMocrenDataPrimitive< T >

Definition at line 50 of file G4GMocrenIO.hh.

Constructor & Destructor Documentation

template<typename T >
GMocrenDataPrimitive< T >::GMocrenDataPrimitive ( )

Definition at line 60 of file G4GMocrenIO.cc.

60  {
61  clear();
62 }
template<typename T >
GMocrenDataPrimitive< T >::~GMocrenDataPrimitive ( )

Definition at line 64 of file G4GMocrenIO.cc.

64  {
65  /*
66  std::vector<short *>::iterator itr = image.begin();
67  for(; itr != image.end(); itr++) {
68  delete [] *itr;
69  }
70  */
71 }

Member Function Documentation

template<typename T>
void GMocrenDataPrimitive< T >::addImage ( T *  _image)

Definition at line 217 of file G4GMocrenIO.cc.

217  {
218  kImage.push_back(_image);
219 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::clear ( )

Definition at line 168 of file G4GMocrenIO.cc.

168  {
169  for(int i = 0; i < 3; i++) {
170  kSize[i] = 0;
171  kCenter[i] = 0.;
172  }
173  kScale = 1.;
174  kMinmax[0] = (T)32109;
175  kMinmax[1] = (T)-32109;
176 
177  clearImage();
178 }

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::clearImage ( )

Definition at line 180 of file G4GMocrenIO.cc.

180  {
181  typename std::vector<T *>::iterator itr;
182  for(itr = kImage.begin(); itr != kImage.end(); itr++) {
183  delete [] *itr;
184  }
185  kImage.clear();
186 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::getCenterPosition ( float  _center[3])

Definition at line 234 of file G4GMocrenIO.cc.

234  {
235  for(int i = 0; i < 3; i++) _center[i] = kCenter[i];
236 }

Here is the caller graph for this function:

template<typename T >
std::vector< T * > & GMocrenDataPrimitive< T >::getImage ( )

Definition at line 221 of file G4GMocrenIO.cc.

221  {
222  return kImage;
223 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56

Here is the caller graph for this function:

template<typename T >
T * GMocrenDataPrimitive< T >::getImage ( int  _z)

Definition at line 225 of file G4GMocrenIO.cc.

225  {
226  if(_z >= (int)kImage.size()) return 0;
227  return kImage[_z];
228 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56
template<typename T>
void GMocrenDataPrimitive< T >::getMinMax ( _minmax[2])

Definition at line 208 of file G4GMocrenIO.cc.

208  {
209  for(int i = 0; i < 2; i++) _minmax[i] = kMinmax[i];
210 
211 }

Here is the caller graph for this function:

template<typename T >
std::string GMocrenDataPrimitive< T >::getName ( void  )

Definition at line 242 of file G4GMocrenIO.cc.

242  {
243  return kDataName;
244 }
std::string kDataName
Definition: G4GMocrenIO.hh:57
template<typename T >
double GMocrenDataPrimitive< T >::getScale ( )

Definition at line 200 of file G4GMocrenIO.cc.

200  {
201  return kScale;
202 }

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::getSize ( int  _size[3])

Definition at line 192 of file G4GMocrenIO.cc.

192  {
193  for(int i = 0; i < 3; i++) _size[i] = kSize[i];
194 }

Here is the caller graph for this function:

template<typename T>
GMocrenDataPrimitive< T > & GMocrenDataPrimitive< T >::operator+ ( const GMocrenDataPrimitive< T > &  _right)

Definition at line 93 of file G4GMocrenIO.cc.

93  {
94 
96  bool stat = true;
97  for(int i = 0; i < 3; i++) {
98  if(kSize[i] != _right.kSize[i]) stat = false;
99  if(kCenter[i] != _right.kCenter[i]) stat = false;
100  }
101  if(!stat) {
103  G4cout << "Warning: operator + "
104  << " Cannot do the operator +"
105  << G4endl;
106  return *this;
107  }
108 
109  rprim.setSize(kSize);
110  rprim.setCenterPosition(kCenter);
111 
112  T mms[2] = {9e100,-9e100};
113  //if(mms[0] > _right.minmax[0]) mms[0] = _right.minmax[0];
114  //if(mms[1] < _right.minmax[1]) mms[1] = _right.minmax[1];
115 
116  int num = kSize[0]*kSize[1];
117  for(int z = 0; z < kSize[2]; z++) {
118  T * img = new T[num];
119  for(int xy = 0; xy < num; xy++) {
120  img[xy] = kImage[z][xy] + _right.kImage[z][xy];
121  if(mms[0] > img[xy]) mms[0] = img[xy];
122  if(mms[1] < img[xy]) mms[1] = img[xy];
123  }
124  rprim.addImage(img);
125  }
126  rprim.setMinMax(mms);
127 
128  T scl = mms[1]/DOSERANGE;
129  rprim.setScale(scl);
130 
131  return rprim;
132 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56
void addImage(T *_image)
Definition: G4GMocrenIO.cc:217
const int DOSERANGE
Definition: G4GMocrenIO.cc:56
G4GLOB_DLL std::ostream G4cout
void setScale(double &_scale)
Definition: G4GMocrenIO.cc:196
void setMinMax(T _minmax[2])
Definition: G4GMocrenIO.cc:204
void setCenterPosition(float _center[3])
Definition: G4GMocrenIO.cc:230
void setSize(int _size[3])
Definition: G4GMocrenIO.cc:188
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

template<typename T>
GMocrenDataPrimitive< T > & GMocrenDataPrimitive< T >::operator+= ( const GMocrenDataPrimitive< T > &  _right)

Definition at line 135 of file G4GMocrenIO.cc.

135  {
136 
137  bool stat = true;
138  for(int i = 0; i < 3; i++) {
139  if(kSize[i] != _right.kSize[i]) stat = false;
140  if(kCenter[i] != _right.kCenter[i]) stat = false;
141  }
142  if(!stat) {
144  G4cout << "Warning: operator += " << G4endl
145  << " Cannot do the operator +="
146  << G4endl;
147  return *this;
148  }
149 
150  if(kMinmax[0] > _right.kMinmax[0]) kMinmax[0] = _right.kMinmax[0];
151  if(kMinmax[1] < _right.kMinmax[1]) kMinmax[1] = _right.kMinmax[1];
152 
153  int num = kSize[0]*kSize[1];
154  for(int z = 0; z < kSize[2]; z++) {
155  for(int xy = 0; xy < num; xy++) {
156  kImage[z][xy] += _right.kImage[z][xy];
157  if(kMinmax[0] > kImage[z][xy]) kMinmax[0] = kImage[z][xy];
158  if(kMinmax[1] < kImage[z][xy]) kMinmax[1] = kImage[z][xy];
159  }
160  }
161 
162  kScale = kMinmax[1]/DOSERANGE;
163 
164  return *this;
165 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56
const int DOSERANGE
Definition: G4GMocrenIO.cc:56
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

template<typename T>
GMocrenDataPrimitive< T > & GMocrenDataPrimitive< T >::operator= ( const GMocrenDataPrimitive< T > &  _right)

Definition at line 74 of file G4GMocrenIO.cc.

74  {
75  if (this == &_right) return *this;
76  for(int i = 0; i < 3; i++) {
77  kSize[i] = _right.kSize[i];
78  kCenter[i] = _right.kCenter[i];
79  }
80  kScale = _right.kScale;
81  for(int i = 0; i < 2; i++) kMinmax[i] = _right.kMinmax[i];
82  int num = kSize[0]*kSize[1];
83  kImage.clear();
84  for(int z = 0; z < kSize[2]; z++) {
85  T * img = new T[num];
86  for(int i = 0; i < num; i++) img[i] =_right.kImage[z][i];
87  kImage.push_back(img);
88  }
89  return *this;
90 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56
template<typename T >
void GMocrenDataPrimitive< T >::setCenterPosition ( float  _center[3])

Definition at line 230 of file G4GMocrenIO.cc.

230  {
231  for(int i = 0; i < 3; i++) kCenter[i] = _center[i];
232 }

Here is the caller graph for this function:

template<typename T>
void GMocrenDataPrimitive< T >::setImage ( std::vector< T * > &  _image)

Definition at line 213 of file G4GMocrenIO.cc.

213  {
214  kImage = _image;
215 }
std::vector< T * > kImage
Definition: G4GMocrenIO.hh:56
template<typename T>
void GMocrenDataPrimitive< T >::setMinMax ( _minmax[2])

Definition at line 204 of file G4GMocrenIO.cc.

204  {
205  for(int i = 0; i < 2; i++) kMinmax[i] = _minmax[i];
206 }

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::setName ( std::string &  _name)

Definition at line 238 of file G4GMocrenIO.cc.

238  {
239  kDataName = _name;
240 }
std::string kDataName
Definition: G4GMocrenIO.hh:57
template<typename T >
void GMocrenDataPrimitive< T >::setScale ( double &  _scale)

Definition at line 196 of file G4GMocrenIO.cc.

196  {
197  kScale = _scale;
198 }

Here is the caller graph for this function:

template<typename T >
void GMocrenDataPrimitive< T >::setSize ( int  _size[3])

Definition at line 188 of file G4GMocrenIO.cc.

188  {
189  for(int i = 0; i < 3; i++) kSize[i] = _size[i];
190 }

Here is the caller graph for this function:

Member Data Documentation

template<typename T>
float GMocrenDataPrimitive< T >::kCenter[3]
protected

Definition at line 55 of file G4GMocrenIO.hh.

template<typename T>
std::string GMocrenDataPrimitive< T >::kDataName
protected

Definition at line 57 of file G4GMocrenIO.hh.

template<typename T>
std::vector<T *> GMocrenDataPrimitive< T >::kImage
protected

Definition at line 56 of file G4GMocrenIO.hh.

template<typename T>
T GMocrenDataPrimitive< T >::kMinmax[2]
protected

Definition at line 54 of file G4GMocrenIO.hh.

template<typename T>
double GMocrenDataPrimitive< T >::kScale
protected

Definition at line 53 of file G4GMocrenIO.hh.

template<typename T>
int GMocrenDataPrimitive< T >::kSize[3]
protected

Definition at line 52 of file G4GMocrenIO.hh.


The documentation for this class was generated from the following files: