Jpp test-rotations-old-533-g2bdbdb559
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 149 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 158 of file JResolution.hh.

159 {
160 TString buffer;
161
162 if (buffer.ReadLine(in)) {
163
164 f1.reset(new TF1("f1", buffer));
165
166 if (!f1->IsValid()) {
167 THROW(JParseError, "Invalid function " << buffer);
168 }
169 }
170
171 return in;
172 }
#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 181 of file JResolution.hh.

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

◆ get()

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

Get direction.

Returns
direction

Implements JASTRONOMY::JResolution.

Definition at line 195 of file JResolution.hh.

196 {
197 using namespace JPP;
198
199 JDirection3D u(0.0, 0.0, 1.0);
200
201 if (f1) {
202
203 const double theta = getRadians(f1->GetRandom(gRandom));
204 const double phi = gRandom->Uniform(-PI, +PI);
205
206 const JRotation3D R(JAngle3D(theta, phi));
207
208 u.rotate_back(R);
209 }
210
211 return u;
212 }
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 215 of file JResolution.hh.


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