Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JASTRONOMY::JResolution_t Struct Reference

Helper for detector resolution. More...

#include <JResolution.hh>

Inheritance diagram for JASTRONOMY::JResolution_t:
JLANG::JTitle

Public Member Functions

 JResolution_t ()
 Default constructor.
 
const std::string & getTitle () const
 Get title.
 
void setTitle (const std::string &title)
 Set title.
 

Protected Attributes

std::map< std::string, std::shared_ptr< JResolution > > dictionary
 
std::string title
 

Friends

std::istream & operator>> (std::istream &in, JResolution_t &object)
 Read detector resolution from input stream.
 
std::ostream & operator<< (std::ostream &out, const JResolution_t &object)
 Write detector resolution to output stream.
 

Detailed Description

Helper for detector resolution.

Definition at line 353 of file JResolution.hh.

Constructor & Destructor Documentation

◆ JResolution_t()

JASTRONOMY::JResolution_t::JResolution_t ( )
inline

Default constructor.

Definition at line 360 of file JResolution.hh.

361 {
362 dictionary["Gauss"] .reset(new JResolutionGauss());
363 dictionary["Formula"] .reset(new JResolutionTF1());
364 dictionary["Histogram"] .reset(new JResolutionTH1());
365 dictionary["Logarithmic"].reset(new JResolutionLog());
366 }
std::map< std::string, std::shared_ptr< JResolution > > dictionary

Member Function Documentation

◆ getTitle()

const std::string & JLANG::JTitle::getTitle ( ) const
inlineinherited

Get title.

Returns
title

Definition at line 55 of file JTitle.hh.

56 {
57 return this->title;
58 }
std::string title
Definition JTitle.hh:73

◆ setTitle()

void JLANG::JTitle::setTitle ( const std::string & title)
inlineinherited

Set title.

Parameters
titletitle

Definition at line 66 of file JTitle.hh.

67 {
68 this->title = title;
69 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JResolution_t & object )
friend

Read detector resolution from input stream.

Parameters
ininput stream
objectdetector resolution
Returns
input stream

Definition at line 376 of file JResolution.hh.

377 {
378 using namespace std;
379
380 string key;
381
382 if (in >> key) {
383
384 if (object.dictionary.count(key)) {
385
386 static_cast<std::shared_ptr<JResolution>&>(object) = object.dictionary[key];
387
388 object.setTitle(key);
389
390 object->read(in);
391
392 } else {
393
394 THROW(JParseError, "Invalid key " << key);
395 }
396 }
397
398 return in;
399 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JResolution_t & object )
friend

Write detector resolution to output stream.

Parameters
outoutput stream
objectdetector resolution
Returns
output stream

Definition at line 409 of file JResolution.hh.

410 {
411 out << object.getTitle() << ' ';
412
413 if (static_cast<const std::shared_ptr<JResolution>&>(object)) {
414 object->write(out);
415 }
416
417 return out;
418 }

Member Data Documentation

◆ dictionary

std::map<std::string, std::shared_ptr<JResolution> > JASTRONOMY::JResolution_t::dictionary
protected

Definition at line 421 of file JResolution.hh.

◆ title

std::string JLANG::JTitle::title
protectedinherited

Definition at line 73 of file JTitle.hh.


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