Jpp 20.0.0-rc.9-4-g539b3ce77
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:
JLANG::JClonable< JClonable_t, JDerived_t >

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

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.
 
virtual clone_type clone () const override
 Get clone of this object.
 

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 153 of file JResolution.hh.

Member Typedef Documentation

◆ clone_type

template<class JClonable_t , class JDerived_t >
JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.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

Definition at line 162 of file JResolution.hh.

163 {
164 TString buffer;
165
166 if (buffer.ReadLine(in)) {
167
168 f1.reset(new TF1("f1", buffer));
169
170 if (!f1->IsValid()) {
171 THROW(JParseError, "Invalid function " << buffer);
172 }
173 }
174
175 return in;
176 }
#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

Definition at line 185 of file JResolution.hh.

186 {
187 if (f1)
188 return out << f1->GetExpFormula();
189 else
190 return out;
191 }

◆ get()

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

Get direction.

Returns
direction

Definition at line 199 of file JResolution.hh.

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

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ f1

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

Definition at line 219 of file JResolution.hh.


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