Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 149 of file computils.h.

Constructor & Destructor Documentation

◆ AxisInfo()

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

Definition at line 153 of file computils.h.

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

Member Function Documentation

◆ autoset()

bool AxisInfo::autoset ( ) const
inline

Definition at line 250 of file computils.h.

250 { return m_autoset; }

◆ binwidth()

double AxisInfo::binwidth ( ) const
inline

Definition at line 269 of file computils.h.

269 { return m_binwidth; }

◆ c_str()

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

Definition at line 271 of file computils.h.

271 { return m_info; }

◆ hi()

double AxisInfo::hi ( ) const
inline

Definition at line 267 of file computils.h.

267 { return m_hi; }

◆ lo()

double AxisInfo::lo ( ) const
inline

Definition at line 266 of file computils.h.

266 { return m_lo; }

◆ log()

bool AxisInfo::log ( ) const
inline

Definition at line 248 of file computils.h.

248 { return m_log; }

◆ normset()

bool AxisInfo::normset ( ) const
inline

Definition at line 252 of file computils.h.

252 { return m_norm; }

◆ offset()

double AxisInfo::offset ( ) const
inline

Definition at line 263 of file computils.h.

263 { return m_offset; }

◆ rangeset()

bool AxisInfo::rangeset ( ) const
inline

Definition at line 258 of file computils.h.

258 { return m_rangeset; }

◆ refnormset()

bool AxisInfo::refnormset ( ) const
inline

Definition at line 254 of file computils.h.

254 { return m_refnorm; }

◆ split()

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

Definition at line 276 of file computils.h.

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

◆ symmetric()

bool AxisInfo::symmetric ( ) const
inline

Definition at line 256 of file computils.h.

256 { return m_symmetric; }

◆ tag()

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

accessors

Definition at line 246 of file computils.h.

246 { return m_tag; }

◆ trim()

bool AxisInfo::trim ( ) const
inline

Definition at line 260 of file computils.h.

260 { return m_trim; }

Member Data Documentation

◆ m_autoset

bool AxisInfo::m_autoset

Definition at line 301 of file computils.h.

◆ m_binwidth

bool AxisInfo::m_binwidth

Definition at line 311 of file computils.h.

◆ m_hi

double AxisInfo::m_hi

Definition at line 306 of file computils.h.

◆ m_info

std::string AxisInfo::m_info

Definition at line 296 of file computils.h.

◆ m_lo

double AxisInfo::m_lo

Definition at line 305 of file computils.h.

◆ m_log

bool AxisInfo::m_log

Definition at line 300 of file computils.h.

◆ m_norm

bool AxisInfo::m_norm

Definition at line 308 of file computils.h.

◆ m_offset

double AxisInfo::m_offset

Definition at line 313 of file computils.h.

◆ m_rangeset

bool AxisInfo::m_rangeset

Definition at line 304 of file computils.h.

◆ m_refnorm

bool AxisInfo::m_refnorm

Definition at line 309 of file computils.h.

◆ m_symmetric

bool AxisInfo::m_symmetric

Definition at line 302 of file computils.h.

◆ m_tag

std::string AxisInfo::m_tag

Definition at line 298 of file computils.h.

◆ m_trim

bool AxisInfo::m_trim

Definition at line 315 of file computils.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
AxisInfo::m_autoset
bool m_autoset
Definition: computils.h:301
AxisInfo::m_tag
std::string m_tag
Definition: computils.h:298
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
AxisInfo::offset
double offset() const
Definition: computils.h:263
AxisInfo::m_info
std::string m_info
Definition: computils.h:296
AxisInfo::m_norm
bool m_norm
Definition: computils.h:308
AxisInfo::m_trim
bool m_trim
Definition: computils.h:315
AxisInfo::m_lo
double m_lo
Definition: computils.h:305
AxisInfo::c_str
const std::string & c_str() const
Definition: computils.h:271
lumiFormat.i
int i
Definition: lumiFormat.py:85
AxisInfo::m_hi
double m_hi
Definition: computils.h:306
calibdata.exit
exit
Definition: calibdata.py:236
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:313
AxisInfo::split
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition: computils.h:276
AxisInfo::m_binwidth
bool m_binwidth
Definition: computils.h:311
AxisInfo::m_rangeset
bool m_rangeset
Definition: computils.h:304
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
AxisInfo::m_log
bool m_log
Definition: computils.h:300
AxisInfo::m_symmetric
bool m_symmetric
Definition: computils.h:302
AxisInfo::m_refnorm
bool m_refnorm
Definition: computils.h:309