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

Implementation of nuisance based on histogram. More...

#include <JNuisance.hh>

Inheritance diagram for JASTRONOMY::JNuisanceTH1:
JASTRONOMY::JNuisance

Public Member Functions

virtual ~JNuisanceTH1 ()
 Virtual destructor.
 
virtual std::istream & read (std::istream &in) override
 Read nuisance from input stream.
 
virtual std::ostream & write (std::ostream &out) const override
 Write nuisance to output stream.
 
double get () const override
 Get value.
 

Public Attributes

std::string filename
 
std::string histname
 

Static Public Attributes

static constexpr double FACTOR = 1.0
 Central value.
 

Protected Member Functions

void load ()
 Load histogram from file.
 

Protected Attributes

TFile * in = NULL
 
TH1D * h1 = NULL
 

Detailed Description

Implementation of nuisance based on histogram.

Definition at line 256 of file JNuisance.hh.

Constructor & Destructor Documentation

◆ ~JNuisanceTH1()

virtual JASTRONOMY::JNuisanceTH1::~JNuisanceTH1 ( )
inlinevirtual

Virtual destructor.

Definition at line 262 of file JNuisance.hh.

263 {
264 if (in != NULL) {
265 in->Close();
266 }
267 }

Member Function Documentation

◆ read()

virtual std::istream & JASTRONOMY::JNuisanceTH1::read ( std::istream & in)
inlineoverridevirtual

Read nuisance from input stream.

Parameters
ininput stream
Returns
input stream

Implements JASTRONOMY::JNuisance.

Definition at line 276 of file JNuisance.hh.

277 {
278 in >> this->filename
279 >> this->histname;
280
281 load();
282
283 return in;
284 }
void load()
Load histogram from file.
Definition JNuisance.hh:318

◆ write()

virtual std::ostream & JASTRONOMY::JNuisanceTH1::write ( std::ostream & out) const
inlineoverridevirtual

Write nuisance to output stream.

Parameters
outoutput stream
Returns
output stream

Implements JASTRONOMY::JNuisance.

Definition at line 293 of file JNuisance.hh.

294 {
295 return out << this->filename << ' '
296 << this->histname;
297 }

◆ get()

double JASTRONOMY::JNuisanceTH1::get ( ) const
inlineoverridevirtual

Get value.

Returns
value

Implements JASTRONOMY::JNuisance.

Definition at line 305 of file JNuisance.hh.

306 {
307 return h1->GetRandom(gRandom);
308 }

◆ load()

void JASTRONOMY::JNuisanceTH1::load ( )
inlineprotected

Load histogram from file.

Definition at line 318 of file JNuisance.hh.

319 {
320 in = TFile::Open(filename.c_str(), "exist");
321
322 if (in == NULL || !in->IsOpen()) {
323 THROW(JFileOpenException, "File: " << filename << " not opened.");
324 }
325
326 h1 = dynamic_cast<TH1D*>(in->Get(histname.c_str()));
327
328 if (h1 == NULL) {
329 THROW(JValueOutOfRange, "Histogram: " << histname << " not found.");
330 }
331 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

Member Data Documentation

◆ filename

std::string JASTRONOMY::JNuisanceTH1::filename

Definition at line 311 of file JNuisance.hh.

◆ histname

std::string JASTRONOMY::JNuisanceTH1::histname

Definition at line 312 of file JNuisance.hh.

◆ in

TFile* JASTRONOMY::JNuisanceTH1::in = NULL
mutableprotected

Definition at line 333 of file JNuisance.hh.

◆ h1

TH1D* JASTRONOMY::JNuisanceTH1::h1 = NULL
mutableprotected

Definition at line 334 of file JNuisance.hh.

◆ FACTOR

double JASTRONOMY::JNuisance::FACTOR = 1.0
staticconstexprinherited

Central value.

Definition at line 45 of file JNuisance.hh.


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