ATLAS Offline Software
Loading...
Searching...
No Matches
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 ()=default
 AxisInfo (const AxisInfo &a)=default
AxisInfo & operator= (const AxisInfo &a)=default
 AxisInfo (const std::string &s)
const std::string & tag () const
 accessors
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 lo (double x)
double hi (double x)
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 = false
bool m_autoset = false
bool m_symmetric = false
bool m_rangeset = false
double m_lo = 0
double m_hi = 0
bool m_norm = false
bool m_refnorm = false
bool m_binwidth = false
double m_offset = 0
bool m_trim = false

Detailed Description

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

Definition at line 154 of file computils.h.

Constructor & Destructor Documentation

◆ AxisInfo() [1/3]

AxisInfo::AxisInfo ( )
default

◆ AxisInfo() [2/3]

AxisInfo::AxisInfo ( const AxisInfo & a)
default

◆ AxisInfo() [3/3]

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

Definition at line 164 of file computils.h.

164 :
165 m_info(s),
166 m_log(false),
167 m_autoset(false),
168 m_symmetric(false),
169 m_rangeset(false),
170 m_lo(0),
171 m_hi(0),
172 m_norm(false),
173 m_refnorm(false),
174 m_binwidth(false),
175 m_offset(0),
176 m_trim(false)
177 {
178 // std::cout << "AxisInfo::info" << m_info << std::endl;
179
180 std::vector<std::string> keys = split( s, ":" );
181
182 // std::cout << "\n\n" << s << "\nnkeys " << keys.size() << std::endl;
183
184 if ( keys.size()>0 ) m_tag = keys[0];
185
186 bool minset = false;
187 // bool maxset = false;
188
189 for ( size_t i=1 ; i<keys.size() ; i++ ) {
190
191 if ( keys[i]=="lin" ) m_log = false;
192 else if ( keys[i]=="log" ) m_log = true;
193 else if ( keys[i]=="sym" ) m_symmetric = true;
194 else if ( keys[i]=="norm" ) m_norm = true;
195 else if ( keys[i]=="refn" ) m_refnorm = true;
196 else if ( keys[i]=="width" ) m_binwidth = true;
197 else if ( keys[i]=="auto" ) m_autoset = true;
198 else if ( keys[i]=="trim" ) m_trim = true;
199 //cppcheck-suppress stlIfStrFind
200 else if ( keys[i].find("offset")==0 ) {
201
202 std::cout << "offset:" << std::endl;
203 std::cout << "\tkey: " << keys[i] << std::endl;
204 std::cout << "\tpos: " << keys[i].find("offset") << std::endl;
205
206 std::string offset = keys[i];
207 m_offset=std::atof(offset.substr(6,offset.size()-6).c_str());
208
209 std::cout << "m_offset: " << m_offset << std::endl;
210 }
211 else if ( keys[i]=="auton" ) {
212 m_autoset = true;
213 m_norm = true;
214 }
215 else if ( keys[i]=="autow" ) {
216 m_autoset = true;
217 m_binwidth = true;
218 }
219 else if ( keys[i]=="autown" || keys[i]=="autonw" ) {
220 m_autoset = true;
221 m_norm = true;
222 m_binwidth = true;
223 }
224 else if ( keys[i]=="autosym" ) {
225 m_autoset = true;
226 m_symmetric = true;
227 }
228 else if ( keys[i]=="normw" || keys[i]=="widthn" ) {
229 m_norm = true;
230 m_binwidth = true;
231 }
232 else if ( !minset ) {
233 m_lo = std::atof(keys[i].c_str());
234 i++;
235 if ( i<keys.size() ) m_hi = std::atof(keys[i].c_str());
236 else {
237 std::cerr << "not enough values for the axis range: " << s << std::endl;
238 std::exit(-1);
239 }
240 minset = true;
241 // maxset = true;
242 m_rangeset = true;
243 }
244 }
245
246#if 0
247 std::cout << "AxisInfo::info" << m_info << "\n";
248 std::cout << "\tlog " << m_log << "\n";
249 std::cout << "\tauto " << m_autoset << "\n";
250 std::cout << "\tsym " << m_symmetric << "\n";
251 std::cout << "\trange " << m_rangeset << " : " << m_lo << " - " << m_hi << std::endl;
252#endif
253
254 }
bool m_binwidth
Definition computils.h:326
bool m_autoset
Definition computils.h:316
double m_lo
Definition computils.h:320
bool m_norm
Definition computils.h:323
double m_offset
Definition computils.h:328
bool m_log
Definition computils.h:315
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition computils.h:291
bool m_symmetric
Definition computils.h:317
double offset() const
Definition computils.h:275
bool m_rangeset
Definition computils.h:319
double m_hi
Definition computils.h:321
const std::string & c_str() const
Definition computils.h:287
std::string m_info
Definition computils.h:311
bool m_trim
Definition computils.h:330
std::string m_tag
Definition computils.h:313
bool m_refnorm
Definition computils.h:324
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140

Member Function Documentation

◆ autoset()

bool AxisInfo::autoset ( ) const
inline

Definition at line 262 of file computils.h.

262{ return m_autoset; }

◆ binwidth()

double AxisInfo::binwidth ( ) const
inline

Definition at line 285 of file computils.h.

285{ return m_binwidth; }

◆ c_str()

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

Definition at line 287 of file computils.h.

287{ return m_info; }

◆ hi() [1/2]

double AxisInfo::hi ( ) const
inline

Definition at line 279 of file computils.h.

279{ return m_hi; }

◆ hi() [2/2]

double AxisInfo::hi ( double x)
inline

Definition at line 282 of file computils.h.

282{ return m_hi=x; }
#define x

◆ lo() [1/2]

double AxisInfo::lo ( ) const
inline

Definition at line 278 of file computils.h.

278{ return m_lo; }

◆ lo() [2/2]

double AxisInfo::lo ( double x)
inline

Definition at line 281 of file computils.h.

281{ return m_lo=x; }

◆ log()

bool AxisInfo::log ( ) const
inline

Definition at line 260 of file computils.h.

260{ return m_log; }

◆ normset()

bool AxisInfo::normset ( ) const
inline

Definition at line 264 of file computils.h.

264{ return m_norm; }

◆ offset()

double AxisInfo::offset ( ) const
inline

Definition at line 275 of file computils.h.

275{ return m_offset; }

◆ operator=()

AxisInfo & AxisInfo::operator= ( const AxisInfo & a)
default

◆ rangeset()

bool AxisInfo::rangeset ( ) const
inline

Definition at line 270 of file computils.h.

270{ return m_rangeset; }

◆ refnormset()

bool AxisInfo::refnormset ( ) const
inline

Definition at line 266 of file computils.h.

266{ return m_refnorm; }

◆ split()

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

Definition at line 291 of file computils.h.

291 :" ) {
292
293 std::string sc = s;
294 size_t pos = sc.find(t);
295
296 std::vector<std::string> tags;
297
298 while ( pos!=std::string::npos ) {
299 tags.push_back( chop(sc,t) );
300 pos = sc.find(t);
301 }
302
303 tags.push_back(sc);
304
305 return tags;
306 }

◆ symmetric()

bool AxisInfo::symmetric ( ) const
inline

Definition at line 268 of file computils.h.

268{ return m_symmetric; }

◆ tag()

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

accessors

Definition at line 258 of file computils.h.

258{ return m_tag; }

◆ trim()

bool AxisInfo::trim ( ) const
inline

Definition at line 272 of file computils.h.

272{ return m_trim; }

Member Data Documentation

◆ m_autoset

bool AxisInfo::m_autoset = false

Definition at line 316 of file computils.h.

◆ m_binwidth

bool AxisInfo::m_binwidth = false

Definition at line 326 of file computils.h.

◆ m_hi

double AxisInfo::m_hi = 0

Definition at line 321 of file computils.h.

◆ m_info

std::string AxisInfo::m_info

Definition at line 311 of file computils.h.

◆ m_lo

double AxisInfo::m_lo = 0

Definition at line 320 of file computils.h.

◆ m_log

bool AxisInfo::m_log = false

Definition at line 315 of file computils.h.

◆ m_norm

bool AxisInfo::m_norm = false

Definition at line 323 of file computils.h.

◆ m_offset

double AxisInfo::m_offset = 0

Definition at line 328 of file computils.h.

◆ m_rangeset

bool AxisInfo::m_rangeset = false

Definition at line 319 of file computils.h.

◆ m_refnorm

bool AxisInfo::m_refnorm = false

Definition at line 324 of file computils.h.

◆ m_symmetric

bool AxisInfo::m_symmetric = false

Definition at line 317 of file computils.h.

◆ m_tag

std::string AxisInfo::m_tag

Definition at line 313 of file computils.h.

◆ m_trim

bool AxisInfo::m_trim = false

Definition at line 330 of file computils.h.


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