Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JASTRONOMY::JNuisance_t Struct Reference

Helper for nuisance I/O. More...

#include <JNuisance.hh>

Inheritance diagram for JASTRONOMY::JNuisance_t:

Public Types

typedef std::map< std::string, nuisance_typedictionary_type
 

Public Member Functions

 JNuisance_t ()
 Default constructor.
 
const dictionary_typegetDictionary () const
 Get dictionary.
 

Protected Attributes

std::string key
 
dictionary_type dictionary
 

Friends

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

Detailed Description

Helper for nuisance I/O.

Definition at line 347 of file JNuisance.hh.

Member Typedef Documentation

◆ dictionary_type

Constructor & Destructor Documentation

◆ JNuisance_t()

JASTRONOMY::JNuisance_t::JNuisance_t ( )
inline

Default constructor.

Definition at line 355 of file JNuisance.hh.

355 :
356 nuisance_type(std::make_shared<JNuisanceFixed>()),
357 key("fixed")
358 {
359 dictionary[key] = static_cast<nuisance_type&>(*this);
360
361 dictionary["Gauss"] .reset(new JNuisanceGauss());
362 dictionary["Formula"] .reset(new JNuisanceTF1());
363 dictionary["Histogram"].reset(new JNuisanceTH1());
364 }
std::shared_ptr< JNuisance > nuisance_type
Type definition of generic nuisance.
Definition JNuisance.hh:341
dictionary_type dictionary
Definition JNuisance.hh:431

Member Function Documentation

◆ getDictionary()

const dictionary_type & JASTRONOMY::JNuisance_t::getDictionary ( ) const
inline

Get dictionary.

Returns
dictionary

Definition at line 372 of file JNuisance.hh.

373 {
374 return dictionary;
375 }

Friends And Related Symbol Documentation

◆ operator>>

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

Read nuisance from input stream.

Parameters
ininput stream
objectnuisance
Returns
input stream

Definition at line 385 of file JNuisance.hh.

386 {
387 using namespace std;
388
389 string key;
390
391 if (in >> key) {
392
393 if (object.dictionary.count(key)) {
394
395 static_cast<nuisance_type&>(object) = object.dictionary[key];
396
397 object.key = key;
398
399 object->read(in);
400
401 } else {
402
403 THROW(JParseError, "Invalid key " << key);
404 }
405 }
406
407 return in;
408 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ operator<<

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

Write nuisance to output stream.

Parameters
outoutput stream
objectnuisance
Returns
output stream

Definition at line 418 of file JNuisance.hh.

419 {
420 out << object.key << ' ';
421
422 if (static_cast<const nuisance_type&>(object)) {
423 object->write(out);
424 }
425
426 return out;
427 }

Member Data Documentation

◆ key

std::string JASTRONOMY::JNuisance_t::key
protected

Definition at line 430 of file JNuisance.hh.

◆ dictionary

dictionary_type JASTRONOMY::JNuisance_t::dictionary
protected

Definition at line 431 of file JNuisance.hh.


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