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

Implementation of detector resolution based on a formula. More...

#include <JResolution.hh>

Inheritance diagram for JASTRONOMY::JResolutionTF1:
JASTRONOMY::JResolution

Public Member Functions

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.
 
JDirection3D get () const override
 Get direction.
 

Public Attributes

std::shared_ptr< TF1 > f1
 

Detailed Description

Implementation of detector resolution based on a formula.

Note that all input angles are in degrees.

Definition at line 147 of file JResolution.hh.

Member Function Documentation

◆ read()

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

Read detector resolution from input stream.

Parameters
ininput stream
Returns
input stream

Implements JASTRONOMY::JResolution.

Definition at line 156 of file JResolution.hh.

157 {
158 TString buffer;
159
160 if (buffer.ReadLine(in)) {
161
162 f1.reset(new TF1("f1", buffer));
163
164 if (!f1->IsValid()) {
165 THROW(JParseError, "Invalid function " << buffer);
166 }
167 }
168
169 return in;
170 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
std::shared_ptr< TF1 > f1

◆ write()

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

Write detector resolution to output stream.

Parameters
outoutput stream
Returns
output stream

Implements JASTRONOMY::JResolution.

Definition at line 179 of file JResolution.hh.

180 {
181 if (f1)
182 return out << f1->GetExpFormula();
183 else
184 return out;
185 }

◆ get()

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

Get direction.

Returns
direction

Implements JASTRONOMY::JResolution.

Definition at line 193 of file JResolution.hh.

194 {
195 using namespace JPP;
196
197 JDirection3D u(0.0, 0.0, 1.0);
198
199 if (f1) {
200
201 const double theta = getRadians(f1->GetRandom(gRandom));
202 const double phi = gRandom->Uniform(-PI, +PI);
203
204 const JRotation3D R(JAngle3D(theta, phi));
205
206 u.rotate_back(R);
207 }
208
209 return u;
210 }
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

Member Data Documentation

◆ f1

std::shared_ptr<TF1> JASTRONOMY::JResolutionTF1::f1

Definition at line 213 of file JResolution.hh.


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