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

Implementation of binary source morphology. More...

#include <JMorphology.hh>

Inheritance diagram for JASTRONOMY::JMorphologyBinary:
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 source morphology from input stream.
 
virtual std::ostream & write (std::ostream &out) const override
 Write source morphology to output stream.
 
virtual JSourceLocation get () const override
 Get location on sky.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Public Attributes

double x1_deg
 
double y1_deg
 
double w1
 
double s1_deg
 
double x2_deg
 
double y2_deg
 
double w2
 
double s2_deg
 

Detailed Description

Implementation of binary source morphology.

Note that all input angles are in degrees.

Definition at line 305 of file JMorphology.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::JMorphologyBinary::read ( std::istream & in)
inlineoverridevirtual

Read source morphology from input stream.

Parameters
ininput stream
Returns
input stream

Definition at line 314 of file JMorphology.hh.

315 {
316 return JMorphology::read(in, *this)
317 >> this->x1_deg >> this->y1_deg >> this->w1 >> this->s1_deg
318 >> this->x2_deg >> this->y2_deg >> this->w2 >> this->s2_deg;
319 }
static std::istream & read(std::istream &in, JSourceLocation &source)
Read source location in degrees from input stream.

◆ write()

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

Write source morphology to output stream.

Parameters
outoutput stream
Returns
output stream

Definition at line 328 of file JMorphology.hh.

329 {
330 return JMorphology::write(out, *this)
331 << ' ' << this->x1_deg << ' ' << this->y1_deg << ' ' << this->w1 << ' ' << this->s1_deg
332 << ' ' << this->x2_deg << ' ' << this->y2_deg << ' ' << this->w2 << ' ' << this->s2_deg;
333 }
static std::ostream & write(std::ostream &out, const JSourceLocation &source)
Write source location in degrees to output stream.

◆ get()

virtual JSourceLocation JASTRONOMY::JMorphologyBinary::get ( ) const
inlineoverridevirtual

Get location on sky.

Returns
location on sky

Definition at line 341 of file JMorphology.hh.

342 {
343 using namespace JPP;
344
345 const double w = gRandom->Uniform(0.0, w1 + w2);
346
347 const double x = sin(getRadians(w < w1 ? x1_deg : x2_deg));
348 const double y = sin(getRadians(w < w1 ? y1_deg : y2_deg));
349 const double s = getRadians(w < w1 ? s1_deg : s2_deg);
350
351 JDirection3D v(x, y, sqrt(1.0 - x*x - y*y));
352
353 JDirection3D u(0.0, 0.0, 1.0);
354
355 if (s > 0.0) {
356
357 const double theta = gRandom->Gaus(0.0, s);
358 const double phi = gRandom->Uniform(-PI, +PI);
359
360 const JRotation3D R(JAngle3D(theta, phi));
361
362 u.rotate_back(R);
363 }
364 {
365 const JRotation3D R(v);
366
367 u.rotate_back(R);
368 }
369
370 const JRotation3D Rs(this->getSourceLocation());
371
372 u.rotate_back(Rs);
373
374 return JSourceLocation(u);
375 }
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).
Location of astrophysical source.

◆ clone()

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

Member Data Documentation

◆ x1_deg

double JASTRONOMY::JMorphologyBinary::x1_deg

Definition at line 378 of file JMorphology.hh.

◆ y1_deg

double JASTRONOMY::JMorphologyBinary::y1_deg

Definition at line 378 of file JMorphology.hh.

◆ w1

double JASTRONOMY::JMorphologyBinary::w1

Definition at line 378 of file JMorphology.hh.

◆ s1_deg

double JASTRONOMY::JMorphologyBinary::s1_deg

Definition at line 378 of file JMorphology.hh.

◆ x2_deg

double JASTRONOMY::JMorphologyBinary::x2_deg

Definition at line 379 of file JMorphology.hh.

◆ y2_deg

double JASTRONOMY::JMorphologyBinary::y2_deg

Definition at line 379 of file JMorphology.hh.

◆ w2

double JASTRONOMY::JMorphologyBinary::w2

Definition at line 379 of file JMorphology.hh.

◆ s2_deg

double JASTRONOMY::JMorphologyBinary::s2_deg

Definition at line 379 of file JMorphology.hh.


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