1#ifndef __JASTRONOMY__JRESOLUTION__
2#define __JASTRONOMY__JRESOLUTION__
64 virtual std::istream&
read(std::istream& in) = 0;
73 virtual std::ostream&
write(std::ostream& out)
const = 0;
98 virtual std::istream&
read(std::istream& in)
override
110 virtual std::ostream&
write(std::ostream& out)
const override
130 const double phi = gRandom->Uniform(-PI, +PI);
158 virtual std::istream&
read(std::istream& in)
override
162 if (buffer.ReadLine(in)) {
164 f1.reset(
new TF1(
"f1", buffer));
166 if (!
f1->IsValid()) {
181 virtual std::ostream&
write(std::ostream& out)
const override
184 return out <<
f1->GetExpFormula();
203 const double theta =
getRadians(
f1->GetRandom(gRandom));
204 const double phi = gRandom->Uniform(-PI, +PI);
215 std::shared_ptr<TF1>
f1;
243 virtual std::istream&
read(std::istream&
in)
override
260 virtual std::ostream&
write(std::ostream& out)
const override
280 const double theta =
getRadians(
h1->GetRandom(gRandom));
281 const double phi = gRandom->Uniform(-PI, +PI);
303 if (
in == NULL || !
in->IsOpen()) {
314 mutable TFile*
in = NULL;
315 mutable TH1D*
h1 = NULL;
339 const double theta =
getRadians(pow(10.0,
h1->GetRandom(gRandom)));
340 const double phi = gRandom->Uniform(-PI, +PI);
407 static_cast<shared_ptr<JResolution>&
>(object) =
object.
dictionary[key];
409 object.setTitle(key);
432 out <<
object.getTitle() <<
' ';
434 if (
static_cast<const std::shared_ptr<JResolution>&
>(
object)) {
Interface methods for SLALIB and auxiliary classes and methods for astronomy.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Data structure for angles in three dimensions.
Data structure for direction in three dimensions.
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
Exception for opening of file.
Exception for parsing value.
Auxiliary class for title.
Exception for accessing a value in a collection that is outside of its range.
std::shared_ptr< JResolution > resolution_type
Type definition of generic resolution.
double getRadians(const double angle)
Convert angle to radians.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Implementation of Gaussian detector resolution.
virtual std::istream & read(std::istream &in) override
Read detector resolution from input stream.
JDirection3D get() const override
Get direction.
virtual std::ostream & write(std::ostream &out) const override
Write detector resolution to output stream.
Implementation of detector resolution based on histogram filled according log10(alpha).
JDirection3D get() const override
Get direction.
Implementation of detector resolution based on a formula.
virtual std::istream & read(std::istream &in) override
Read detector resolution from input stream.
JDirection3D get() const override
Get direction.
std::shared_ptr< TF1 > f1
virtual std::ostream & write(std::ostream &out) const override
Write detector resolution to output stream.
Implementation of detector resolution based on histogram.
virtual std::istream & read(std::istream &in) override
Read detector resolution from input stream.
virtual ~JResolutionTH1()
Virtual destructor.
void load()
Load histogram from file.
JDirection3D get() const override
Get direction.
virtual std::ostream & write(std::ostream &out) const override
Write detector resolution to output stream.
Helper for detector resolution I/O.
dictionary_type dictionary
std::map< std::string, resolution_type > dictionary_type
friend std::ostream & operator<<(std::ostream &out, const JResolution_t &object)
Write detector resolution to output stream.
JResolution_t()
Default constructor.
friend std::istream & operator>>(std::istream &in, JResolution_t &object)
Read detector resolution from input stream.
const dictionary_type & getDictionary() const
Get dictionary.
Interface for detector resolution simulation.
virtual JDirection3D get() const =0
Get direction.
virtual ~JResolution()
Virtual destructor.
virtual std::istream & read(std::istream &in)=0
Read detector resolution from input stream.
virtual std::ostream & write(std::ostream &out) const =0
Write detector resolution to output stream.