ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
AxisInfo Class Reference

class to store information about axes, limits, whether it is log or linear scale etc More...

#include <computils.h>

Collaboration diagram for AxisInfo:

Public Member Functions

 AxisInfo (const std::string &s)
 
const std::string & tag () const
 accessors More...
 
bool log () const
 
bool autoset () const
 
bool normset () const
 
bool refnormset () const
 
bool symmetric () const
 
bool rangeset () const
 
bool trim () const
 
double offset () const
 
double lo () const
 
double hi () const
 
double binwidth () const
 
const std::string & c_str () const
 

Static Public Member Functions

static std::vector< std::string > split (const std::string &s, const std::string &t=":")
 

Public Attributes

std::string m_info
 
std::string m_tag
 
bool m_log
 
bool m_autoset
 
bool m_symmetric
 
bool m_rangeset
 
double m_lo
 
double m_hi
 
bool m_norm
 
bool m_refnorm
 
bool m_binwidth
 
double m_offset
 
bool m_trim
 

Detailed Description

class to store information about axes, limits, whether it is log or linear scale etc

Definition at line 150 of file computils.h.

Constructor & Destructor Documentation

◆ AxisInfo()

AxisInfo::AxisInfo ( const std::string &  s)
inline

Definition at line 154 of file computils.h.

154  :
155  m_info(s),
156  m_log(false),
157  m_autoset(false),
158  m_symmetric(false),
159  m_rangeset(false),
160  m_lo(0),
161  m_hi(0),
162  m_norm(false),
163  m_refnorm(false),
164  m_binwidth(false),
165  m_offset(0),
166  m_trim(false)
167  {
168  // std::cout << "AxisInfo::info" << m_info << std::endl;
169 
170  std::vector<std::string> keys = split( s, ":" );
171 
172  // std::cout << "\n\n" << s << "\nnkeys " << keys.size() << std::endl;
173 
174  if ( keys.size()>0 ) m_tag = keys[0];
175 
176  bool minset = false;
177  // bool maxset = false;
178 
179  for ( size_t i=1 ; i<keys.size() ; i++ ) {
180 
181  if ( keys[i]=="lin" ) m_log = false;
182  else if ( keys[i]=="log" ) m_log = true;
183  else if ( keys[i]=="sym" ) m_symmetric = true;
184  else if ( keys[i]=="norm" ) m_norm = true;
185  else if ( keys[i]=="refn" ) m_refnorm = true;
186  else if ( keys[i]=="width" ) m_binwidth = true;
187  else if ( keys[i]=="auto" ) m_autoset = true;
188  else if ( keys[i]=="trim" ) m_trim = true;
189  //cppcheck-suppress stlIfStrFind
190  else if ( keys[i].find("offset")==0 ) {
191 
192  std::cout << "offset:" << std::endl;
193  std::cout << "\tkey: " << keys[i] << std::endl;
194  std::cout << "\tpos: " << keys[i].find("offset") << std::endl;
195 
196  std::string offset = keys[i];
197  m_offset=std::atof(offset.substr(6,offset.size()-6).c_str());
198 
199  std::cout << "m_offset: " << m_offset << std::endl;
200  }
201  else if ( keys[i]=="auton" ) {
202  m_autoset = true;
203  m_norm = true;
204  }
205  else if ( keys[i]=="autow" ) {
206  m_autoset = true;
207  m_binwidth = true;
208  }
209  else if ( keys[i]=="autown" || keys[i]=="autonw" ) {
210  m_autoset = true;
211  m_norm = true;
212  m_binwidth = true;
213  }
214  else if ( keys[i]=="autosym" ) {
215  m_autoset = true;
216  m_symmetric = true;
217  }
218  else if ( keys[i]=="normw" || keys[i]=="widthn" ) {
219  m_norm = true;
220  m_binwidth = true;
221  }
222  else if ( !minset ) {
223  m_lo = std::atof(keys[i].c_str());
224  i++;
225  if ( i<keys.size() ) m_hi = std::atof(keys[i].c_str());
226  else {
227  std::cerr << "not enough values for the axis range: " << s << std::endl;
228  std::exit(-1);
229  }
230  minset = true;
231  // maxset = true;
232  m_rangeset = true;
233  }
234  }
235 
236 #if 0
237  std::cout << "AxisInfo::info" << m_info << "\n";
238  std::cout << "\tlog " << m_log << "\n";
239  std::cout << "\tauto " << m_autoset << "\n";
240  std::cout << "\tsym " << m_symmetric << "\n";
241  std::cout << "\trange " << m_rangeset << " : " << m_lo << " - " << m_hi << std::endl;
242 #endif
243 
244  }

Member Function Documentation

◆ autoset()

bool AxisInfo::autoset ( ) const
inline

Definition at line 252 of file computils.h.

252 { return m_autoset; }

◆ binwidth()

double AxisInfo::binwidth ( ) const
inline

Definition at line 271 of file computils.h.

271 { return m_binwidth; }

◆ c_str()

const std::string& AxisInfo::c_str ( ) const
inline

Definition at line 273 of file computils.h.

273 { return m_info; }

◆ hi()

double AxisInfo::hi ( ) const
inline

Definition at line 269 of file computils.h.

269 { return m_hi; }

◆ lo()

double AxisInfo::lo ( ) const
inline

Definition at line 268 of file computils.h.

268 { return m_lo; }

◆ log()

bool AxisInfo::log ( ) const
inline

Definition at line 250 of file computils.h.

250 { return m_log; }

◆ normset()

bool AxisInfo::normset ( ) const
inline

Definition at line 254 of file computils.h.

254 { return m_norm; }

◆ offset()

double AxisInfo::offset ( ) const
inline

Definition at line 265 of file computils.h.

265 { return m_offset; }

◆ rangeset()

bool AxisInfo::rangeset ( ) const
inline

Definition at line 260 of file computils.h.

260 { return m_rangeset; }

◆ refnormset()

bool AxisInfo::refnormset ( ) const
inline

Definition at line 256 of file computils.h.

256 { return m_refnorm; }

◆ split()

static std::vector<std::string> AxisInfo::split ( const std::string &  s,
const std::string &  t = ":" 
)
inlinestatic

Definition at line 278 of file computils.h.

278  :" ) {
279 
280  std::string sc = s;
281  size_t pos = sc.find(t);
282 
283  std::vector<std::string> tags;
284 
285  while ( pos!=std::string::npos ) {
286  tags.push_back( chop(sc,t) );
287  pos = sc.find(t);
288  }
289 
290  tags.push_back(sc);
291 
292  return tags;
293  }

◆ symmetric()

bool AxisInfo::symmetric ( ) const
inline

Definition at line 258 of file computils.h.

258 { return m_symmetric; }

◆ tag()

const std::string& AxisInfo::tag ( ) const
inline

accessors

Definition at line 248 of file computils.h.

248 { return m_tag; }

◆ trim()

bool AxisInfo::trim ( ) const
inline

Definition at line 262 of file computils.h.

262 { return m_trim; }

Member Data Documentation

◆ m_autoset

bool AxisInfo::m_autoset

Definition at line 303 of file computils.h.

◆ m_binwidth

bool AxisInfo::m_binwidth

Definition at line 313 of file computils.h.

◆ m_hi

double AxisInfo::m_hi

Definition at line 308 of file computils.h.

◆ m_info

std::string AxisInfo::m_info

Definition at line 298 of file computils.h.

◆ m_lo

double AxisInfo::m_lo

Definition at line 307 of file computils.h.

◆ m_log

bool AxisInfo::m_log

Definition at line 302 of file computils.h.

◆ m_norm

bool AxisInfo::m_norm

Definition at line 310 of file computils.h.

◆ m_offset

double AxisInfo::m_offset

Definition at line 315 of file computils.h.

◆ m_rangeset

bool AxisInfo::m_rangeset

Definition at line 306 of file computils.h.

◆ m_refnorm

bool AxisInfo::m_refnorm

Definition at line 311 of file computils.h.

◆ m_symmetric

bool AxisInfo::m_symmetric

Definition at line 304 of file computils.h.

◆ m_tag

std::string AxisInfo::m_tag

Definition at line 300 of file computils.h.

◆ m_trim

bool AxisInfo::m_trim

Definition at line 317 of file computils.h.


The documentation for this class was generated from the following file:
AxisInfo::m_autoset
bool m_autoset
Definition: computils.h:303
AxisInfo::m_tag
std::string m_tag
Definition: computils.h:300
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
AxisInfo::offset
double offset() const
Definition: computils.h:265
AxisInfo::m_info
std::string m_info
Definition: computils.h:298
AxisInfo::m_norm
bool m_norm
Definition: computils.h:310
AxisInfo::m_trim
bool m_trim
Definition: computils.h:317
AxisInfo::m_lo
double m_lo
Definition: computils.h:307
AxisInfo::c_str
const std::string & c_str() const
Definition: computils.h:273
lumiFormat.i
int i
Definition: lumiFormat.py:85
AxisInfo::m_hi
double m_hi
Definition: computils.h:308
calibdata.exit
exit
Definition: calibdata.py:235
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
AxisInfo::m_offset
double m_offset
Definition: computils.h:315
AxisInfo::split
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition: computils.h:278
AxisInfo::m_binwidth
bool m_binwidth
Definition: computils.h:313
AxisInfo::m_rangeset
bool m_rangeset
Definition: computils.h:306
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
AxisInfo::m_log
bool m_log
Definition: computils.h:302
AxisInfo::m_symmetric
bool m_symmetric
Definition: computils.h:304
AxisInfo::m_refnorm
bool m_refnorm
Definition: computils.h:311