g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
tools::histo::dps Class Reference

Public Member Functions

 dps ()
 
 dps (const std::string &a_title, unsigned int a_dim)
 
virtual ~dps ()
 
 dps (const dps &a_from)
 
dpsoperator= (const dps &a_from)
 
const std::string & title () const
 
void set_title (const std::string &a_s)
 
unsigned int dimension () const
 
void clear ()
 
size_t size () const
 
const data_pointpoint (size_t a_index) const
 
data_pointpoint (size_t a_index)
 
data_pointadd_point ()
 
bool remove_point (size_t a_index)
 
bool lower_extent (unsigned int a_coord, double &a_value) const
 
bool upper_extent (unsigned int a_coord, double &a_value) const
 
void scale (double a_scale)
 
void scale_value (double a_scale)
 
void scale_errors (double a_scale)
 

Static Public Member Functions

static const std::string & s_class ()
 

Protected Attributes

std::string m_title
 
unsigned int m_dim
 
std::vector< data_pointm_points
 

Detailed Description

Definition at line 119 of file dps.

Constructor & Destructor Documentation

◆ dps() [1/3]

tools::histo::dps::dps ( )
inline

Definition at line 126 of file dps.

126 :m_dim(0){}

◆ dps() [2/3]

tools::histo::dps::dps ( const std::string &  a_title,
unsigned int  a_dim 
)
inline

Definition at line 128 of file dps.

129  :m_title(a_title),m_dim(a_dim)
130  {}

◆ ~dps()

virtual tools::histo::dps::~dps ( )
inlinevirtual

Definition at line 131 of file dps.

131 {}

◆ dps() [3/3]

tools::histo::dps::dps ( const dps a_from)
inline

Definition at line 133 of file dps.

134  :m_title(a_from.m_title)
135  ,m_dim(a_from.m_dim)
136  ,m_points(a_from.m_points)
137  {}

Member Function Documentation

◆ add_point()

data_point& tools::histo::dps::add_point ( )
inline

Definition at line 164 of file dps.

164  {
165  m_points.push_back(data_point(m_dim));
166  return m_points.back();
167  }

◆ clear()

void tools::histo::dps::clear ( )
inline

Definition at line 152 of file dps.

152 {m_points.clear();}

◆ dimension()

unsigned int tools::histo::dps::dimension ( ) const
inline

Definition at line 151 of file dps.

151 {return m_dim;}

◆ lower_extent()

bool tools::histo::dps::lower_extent ( unsigned int  a_coord,
double &  a_value 
) const
inline

Definition at line 180 of file dps.

180  {
181  if(m_points.empty()||(a_coord>=m_dim)){
182  a_value = 0;
183  return false;
184  }
185  std::vector<data_point>::const_iterator it = m_points.begin();
186  a_value = (*it).coordinate(a_coord).value();
187  ++it;
188  for(;it!=m_points.end();++it) {
189  a_value = mn<double>(a_value,(*it).coordinate(a_coord).value());
190  }
191  return true;
192  }

◆ operator=()

dps& tools::histo::dps::operator= ( const dps a_from)
inline

Definition at line 138 of file dps.

138  {
139  if(&a_from==this) return *this;
140  m_title = a_from.m_title;
141  m_dim = a_from.m_dim;
142  m_points = a_from.m_points;
143  return *this;
144  }

◆ point() [1/2]

data_point& tools::histo::dps::point ( size_t  a_index)
inline

Definition at line 159 of file dps.

159  {
160  //WARNING : no check done on a_index.
161  return m_points[a_index];
162  }

◆ point() [2/2]

const data_point& tools::histo::dps::point ( size_t  a_index) const
inline

Definition at line 155 of file dps.

155  {
156  //WARNING : no check done on a_index.
157  return m_points[a_index];
158  }

◆ remove_point()

bool tools::histo::dps::remove_point ( size_t  a_index)
inline

Definition at line 169 of file dps.

169  {
170  bool done = false;
171  if(a_index<m_points.size()){
172  std::vector<data_point>::iterator it = m_points.begin();
173  it += a_index;
174  m_points.erase(it);
175  done = true;
176  }
177  return done;
178  }

◆ s_class()

static const std::string& tools::histo::dps::s_class ( )
inlinestatic

Definition at line 121 of file dps.

121  {
122  static const std::string s_v("tools::histo::dps");
123  return s_v;
124  }

◆ scale()

void tools::histo::dps::scale ( double  a_scale)
inline

Definition at line 208 of file dps.

208  {
209  std::vector<data_point>::iterator it;
210  for(it=m_points.begin();it!=m_points.end();++it) {
211  for(unsigned int coord=0;coord<m_dim;coord++) {
212  measurement& m = (*it).coordinate(coord);
213  m.set_value(m.value() * a_scale);
214  m.set_error_plus(m.error_plus() * a_scale);
215  m.set_error_minus(m.error_minus() * a_scale);
216  }
217  }
218  }

◆ scale_errors()

void tools::histo::dps::scale_errors ( double  a_scale)
inline

Definition at line 230 of file dps.

230  {
231  std::vector<data_point>::iterator it;
232  for(it=m_points.begin();it!=m_points.end();++it) {
233  for(unsigned int coord=0;coord<m_dim;coord++) {
234  measurement& m = (*it).coordinate(coord);
235  m.set_error_plus(m.error_plus() * a_scale);
236  m.set_error_minus(m.error_minus() * a_scale);
237  }
238  }
239  }

◆ scale_value()

void tools::histo::dps::scale_value ( double  a_scale)
inline

Definition at line 220 of file dps.

220  {
221  std::vector<data_point>::iterator it;
222  for(it=m_points.begin();it!=m_points.end();++it) {
223  for(unsigned int coord=0;coord<m_dim;coord++) {
224  measurement& m = (*it).coordinate(coord);
225  m.set_value(m.value() * a_scale);
226  }
227  }
228  }

◆ set_title()

void tools::histo::dps::set_title ( const std::string &  a_s)
inline

Definition at line 149 of file dps.

149 {m_title = a_s;}

◆ size()

size_t tools::histo::dps::size ( ) const
inline

Definition at line 153 of file dps.

153 {return m_points.size();}

◆ title()

const std::string& tools::histo::dps::title ( ) const
inline

Definition at line 147 of file dps.

147 {return m_title;}

◆ upper_extent()

bool tools::histo::dps::upper_extent ( unsigned int  a_coord,
double &  a_value 
) const
inline

Definition at line 194 of file dps.

194  {
195  if(m_points.empty()||(a_coord>=m_dim)){
196  a_value = 0;
197  return false;
198  }
199  std::vector<data_point>::const_iterator it = m_points.begin();
200  a_value = (*it).coordinate(a_coord).value();
201  ++it;
202  for(;it!=m_points.end();++it) {
203  a_value = mx<double>(a_value,(*it).coordinate(a_coord).value());
204  }
205  return true;
206  }

Member Data Documentation

◆ m_dim

unsigned int tools::histo::dps::m_dim
protected

Definition at line 243 of file dps.

◆ m_points

std::vector<data_point> tools::histo::dps::m_points
protected

Definition at line 244 of file dps.

◆ m_title

std::string tools::histo::dps::m_title
protected

Definition at line 242 of file dps.


The documentation for this class was generated from the following file:
tools::histo::dps::m_title
std::string m_title
Definition: dps:242
tools::histo::dps::m_points
std::vector< data_point > m_points
Definition: dps:244
tools::histo::dps::m_dim
unsigned int m_dim
Definition: dps:243