46 const GModelRegistry g_com_drb_bin_fitting_registry(&g_com_drb_bin_fitting_seed);
49 #define G_EVAL "GCOMModelDRBPhibarBins::eval(GEvent&, GObservation&, bool&)"
50 #define G_NRED "GCOMModelDRBPhibarBins::npred(GEnergy&, GTime&, "\
52 #define G_MC "GCOMModelDRBPhibarBins::mc(GObservation&, GRan&)"
53 #define G_READ "GCOMModelDRBPhibarBins::read(GXmlElement&)"
54 #define G_WRITE "GCOMModelDRBPhibarBins::write(GXmlElement&)"
166 if (
this != &model) {
249 const bool& gradients)
const
253 if (observation == NULL) {
254 std::string cls = std::string(
typeid(&obs).
name());
255 std::string msg =
"Observation of type \""+cls+
"\" is not a COMPTEL "
256 "observations. Please specify a COMPTEL observation "
264 std::string cls = std::string(
typeid(&event).
name());
265 std::string msg =
"Event of type \""+cls+
"\" is not a COMPTEL event. "
266 "Please specify a COMPTEL event as argument.";
274 std::string msg =
"Number of "+
gammalib::str(nphi)+
" Phibar layers "
276 " DRB Phibar bin fitting model parameters. Please "
277 "specify a model that is compatible with the data "
282 std::string msg =
"There are no Chi/Psi pixels in the DRB model. "
283 "Please specify a model that contains Chi/Psi "
293 for (
int i = 0; i <
m_values.size(); ++i) {
305 int index = bin->
index();
306 int iphi = index / npix;
318 double grad = (
m_values[iphi].is_free())
322 m_values[iphi].factor_gradient(grad);
330 #if defined(G_NAN_CHECK)
332 std::cout <<
"*** ERROR: GCOMModelDRBPhibarBins::eval";
333 std::cout <<
"(index=" << index <<
"):";
334 std::cout <<
" NaN/Inf encountered";
335 std::cout <<
" (iphi=" << iphi;
336 std::cout <<
", value=" << value;
337 std::cout <<
", scale=" <<
scale;
338 std::cout <<
")" << std::endl;
366 const GTime& obsTime,
373 std::string msg =
"Spatial integration of data model is not implemented.";
403 std::string msg =
"Monte Carlo simulation of data model is not implemented.";
434 int bins = xml.
elements(
"parameter");
437 for (
int i = 0; i < bins; ++i) {
444 normalization.
read(*par);
447 std::string normalization_name =
"Phibar normalization "+
gammalib::str(i);
450 normalization.
name(normalization_name);
451 normalization.
unit(
"");
498 for (
int k = 0; k < n; ++k) {
509 src = xml.
append(
"source");
519 std::string msg =
"Invalid model type \""+src->
attribute(
"type")+
"\" "
520 "found in XML file. Model type \""+
type()+
"\" "
530 for (
int i = 0; i < bins; ++i) {
537 std::string msg =
"Invalid number of bins "+
539 " found in XML file, but model requires exactly "+
545 for (
int i = 0; i < bins; ++i) {
550 mpar.
name(
"Normalization");
578 result.append(
"=== GCOMModelDRBPhibarBins ===");
586 for (
int i = 0; i <
size(); ++i) {
659 for (
int i = 0; i < bins; ++i) {
void free_members(void)
Delete class members.
const int & index(void) const
Return bin index.
virtual GCOMModelDRBPhibarBins & operator=(const GCOMModelDRBPhibarBins &model)
Assignment operator.
const std::string & name(void) const
Return parameter name.
std::string print_attributes(void) const
Print model attributes.
const GCOMModelDRBPhibarBins g_com_drb_bin_fitting_seed
COMPTEL DRB model Phibar bin fitting class.
XML element node class interface definition.
Interface definition for the model registry class.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
COMPTEL observation class interface definition.
Abstract interface for the event classes.
void free_members(void)
Delete class members.
const GCOMDri & drb(void) const
Return background model.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const
Evaluate function.
virtual void clear(void)
Clear instance.
Random number generator class.
virtual int elements(void) const
Return number of GXMLElement children of node.
void free_members(void)
Delete class members.
virtual GCOMEventCube * mc(const GObservation &obs, GRan &ran) const
Return simulated list of events.
virtual void read(const GXmlElement &xml)
Read model from XML element.
COMPTEL event bin class interface definition.
bool is_notanumber(const double &x)
Signal if argument is not a number.
std::vector< GModelPar * > m_pars
Pointers to all model parameters.
int size(void) const
Return number of parameters in model.
bool is_infinite(const double &x)
Signal if argument is infinite.
void init_members(void)
Initialise class members.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
virtual GCOMModelDRBPhibarBins * clone(void) const
Clone instance.
const GXmlAttribute * attribute(const int &index) const
Return attribute.
const int & nmaps(void) const
Returns number of maps.
virtual std::string type(void) const
Return model type.
const std::string & name(void) const
Return parameter name.
void copy_members(const GCOMModelDRBPhibarBins &model)
Copy class members.
const GSkyMap & map(void) const
Return DRI sky map.
std::vector< GModelPar > m_values
Normalisation values.
Abstract event base class definition.
Abstract data model class.
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
std::string instruments(void) const
Returns instruments to which model applies.
Abstract observation base class.
COMPTEL event bin container class.
Abstract observation base class interface definition.
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return spatially integrated data model.
GModelPar & scale(const int &index)
Returns reference to scale parameter by index.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void write_attributes(GXmlElement &xml) const
Write model attributes.
virtual GXmlElement * element(const int &index)
Return pointer to GXMLElement child.
GCOMModelDRBPhibarBins(void)
Void constructor.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
Interface class for COMPTEL observations.
virtual ~GCOMModelDRBPhibarBins(void)
Destructor.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print model information.
const std::string & unit(void) const
Return parameter unit.
Exception handler interface definition.
void read_attributes(const GXmlElement &xml)
Read model attributes.
Model registry class definition.
void init_members(void)
Initialise class members.
virtual GXmlNode * append(const GXmlNode &node)
Append XML child node.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
virtual double size(void) const
Return size of event bin.
COMPTEL DRB model Phibar bin fitting class interface definition.
const int & npix(void) const
Returns number of pixels.
void set_pointers(void)
Set pointers.
const double * pixels(void) const
Returns pointer to pixel data.
void init_members(void)
Initialise class members.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.