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

Implementation of detector resolution based on histogram filled according log10(alpha). More...

#include <JResolution.hh>

Inheritance diagram for JASTRONOMY::JResolutionLog:
JASTRONOMY::JResolutionTH1 JASTRONOMY::JResolution

Public Member Functions

JDirection3D get () const override
 Get direction.
 
virtual std::istream & read (std::istream &in) override
 Read detector resolution from input stream.
 
virtual std::ostream & write (std::ostream &out) const override
 Write detector resolution to output stream.
 

Public Attributes

std::string filename
 
std::string histname
 

Protected Member Functions

void load ()
 Load histogram from file.
 

Protected Attributes

TFile * in = NULL
 
TH1D * h1 = NULL
 

Detailed Description

Implementation of detector resolution based on histogram filled according log10(alpha).

Note that all input angles are in degrees.

Definition at line 323 of file JResolution.hh.

Member Function Documentation

◆ get()

JDirection3D JASTRONOMY::JResolutionLog::get ( ) const
inlineoverridevirtual

Get direction.

Returns
direction

Implements JASTRONOMY::JResolution.

Definition at line 331 of file JResolution.hh.

332 {
333 using namespace JPP;
334
335 JDirection3D u(0.0, 0.0, 1.0);
336
337 if (h1 != NULL) {
338
339 const double theta = getRadians(pow(10.0,h1->GetRandom(gRandom)));
340 const double phi = gRandom->Uniform(-PI, +PI);
341
342 const JRotation3D R(JAngle3D(theta, phi));
343
344 u.rotate_back(R);
345 }
346
347 return u;
348 }
Data structure for angles in three dimensions.
Definition JAngle3D.hh:35
Data structure for direction in three dimensions.
double getRadians(const double angle)
Convert angle to radians.
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ read()

virtual std::istream & JASTRONOMY::JResolutionTH1::read ( std::istream & in)
inlineoverridevirtualinherited

Read detector resolution from input stream.

Parameters
ininput stream
Returns
input stream

Implements JASTRONOMY::JResolution.

Definition at line 243 of file JResolution.hh.

244 {
245 in >> this->filename
246 >> this->histname;
247
248 load();
249
250 return in;
251 }
void load()
Load histogram from file.

◆ write()

virtual std::ostream & JASTRONOMY::JResolutionTH1::write ( std::ostream & out) const
inlineoverridevirtualinherited

Write detector resolution to output stream.

Parameters
outoutput stream
Returns
output stream

Implements JASTRONOMY::JResolution.

Definition at line 260 of file JResolution.hh.

261 {
262 return out << this->filename << ' '
263 << this->histname;
264 }

◆ load()

void JASTRONOMY::JResolutionTH1::load ( )
inlineprotectedinherited

Load histogram from file.

Definition at line 299 of file JResolution.hh.

300 {
301 in = TFile::Open(filename.c_str(), "exist");
302
303 if (in == NULL || !in->IsOpen()) {
304 THROW(JFileOpenException, "File: " << filename << " not opened.");
305 }
306
307 h1 = dynamic_cast<TH1D*>(in->Get(histname.c_str()));
308
309 if (h1 == NULL) {
310 THROW(JValueOutOfRange, "Histogram: " << histname << " not found.");
311 }
312 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

Member Data Documentation

◆ filename

std::string JASTRONOMY::JResolutionTH1::filename
inherited

Definition at line 292 of file JResolution.hh.

◆ histname

std::string JASTRONOMY::JResolutionTH1::histname
inherited

Definition at line 293 of file JResolution.hh.

◆ in

TFile* JASTRONOMY::JResolutionTH1::in = NULL
mutableprotectedinherited

Definition at line 314 of file JResolution.hh.

◆ h1

TH1D* JASTRONOMY::JResolutionTH1::h1 = NULL
mutableprotectedinherited

Definition at line 315 of file JResolution.hh.


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