79 distributions_(D, nullptr)
81 this->setName(this->getProductName());
84 for (
UInt dim = 0; dim < D; ++dim)
87 this->subsections_.push_back(name);
88 this->defaults_.setValue(name,
"GaussModel",
"Name of the model used for this dimension");
92 this->defaults_.setValue(
"intensity_scaling", 1.0,
"Scaling factor used to adjust the model distribution to the intensities of the data");
93 this->defaultsToParam_();
99 distributions_(D, nullptr),
100 scale_(source.scale_)
102 for (
UInt dim = 0; dim < D; ++dim)
105 if (source.distributions_[dim])
117 for (
Size dim = 0; dim < D; ++dim)
119 delete distributions_[dim];
126 if (&source ==
this)
return *
this;
129 scale_ = source.scale_;
131 for (
UInt dim = 0; dim < D; ++dim)
133 if (source.distributions_[dim])
141 distributions_[dim] =
nullptr;
153 for (
UInt dim = 0; dim < D; ++dim)
155 if (distributions_[dim] ==
nullptr)
159 intens *= distributions_[dim]->getIntensity(pos[dim]);
173 return String(
"ProductModel") + D +
"D";
186 if (dist ==
nullptr || dist == distributions_[dim])
191 delete distributions_[dim];
192 distributions_[dim] = dist;
196 this->param_.removeAll(name +
':');
197 this->param_.insert(name +
':', distributions_[dim]->getParameters());
198 this->param_.setValue(name, distributions_[dim]->getName());
206 return distributions_[dim];
218 this->setCutOff(this->getCutOff() / scale_);
220 this->param_.setValue(
"intensity_scaling", scale);
221 this->setCutOff(this->getCutOff() * scale_);
229 std::vector<Samples1D> samples(D);
231 for (
Size dim = 0; dim < D; ++dim)
233 distributions_[dim]->getSamples(samples[dim]);
237 std::vector<UInt> i(D, 0);
239 while (i[D - 1] < samples[D - 1].size())
241 for (
UInt dim = 0; dim < D; ++dim)
243 peak.getPosition()[dim] = samples[dim][i[dim]].getPosition()[0];
246 cont.push_back(peak);
249 for (
Size dim = 0; dim < D - 1; ++dim)
251 if (i[dim] >= samples[dim].size())
265 scale_ = (double)(this->param_.getValue(
"intensity_scaling"));
266 for (
UInt dim = 0; dim < D; ++dim)
269 if (this->param_.exists(name))
271 delete distributions_[dim];
273 Param copy = this->param_.
copy(name +
":",
true);
274 distributions_[dim]->setParameters(copy);
275 if (distributions_[dim]->getName().hasSubstring(
"IsotopeModel"))
Abstract base class for all D-dimensional models.
Definition: BaseModel.h:52
DPeak< D >::Type PeakType
Definition: BaseModel.h:59
std::vector< PeakType > SamplesType
Definition: BaseModel.h:60
virtual BaseModel & operator=(const BaseModel &source)
assignment operator
Definition: BaseModel.h:83
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: BaseModel.h:157
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:54
Exception base class.
Definition: Exception.h:92
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:63
Isotope distribution approximated using linear interpolation.
Definition: IsotopeModel.h:60
EmpiricalFormula getFormula()
return the Averagine peptide formula (mass calculated from mean mass and charge – use ....
Stores the name and parameters of a model.
Definition: ModelDescription.h:54
BaseModel< D > * createModel()
Definition: ModelDescription.h:96
Management and storage of parameters / INI files.
Definition: Param.h:70
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
static char const * shortDimensionName(UInt const dim)
Short name of the dimension (abbreviated form)
IntensityType getScale() const
return the intensity scaling factor
Definition: ProductModel.h:210
std::vector< BaseModel< 1 > * > distributions_
Definition: ProductModel.h:283
IntensityType scale_
Definition: ProductModel.h:284
DPosition< D > PositionType
Definition: ProductModel.h:73
BaseModel< D >::SamplesType SamplesType
Definition: ProductModel.h:74
ProductModel()
Default constructor.
Definition: ProductModel.h:77
void setScale(IntensityType scale)
set the intensity scaling factor
Definition: ProductModel.h:216
static BaseModel< D > * create()
create new ProductModel object (needed by Factory)
Definition: ProductModel.h:165
virtual ProductModel & operator=(const ProductModel &source)
assignment operator
Definition: ProductModel.h:124
BaseModel< 1 > * getModel(UInt dim) const
Definition: ProductModel.h:203
IntensityType getIntensity(const PositionType &pos) const override
intensity equals product of intensities in each dimension
Definition: ProductModel.h:150
ProductModel & setModel(UInt dim, BaseModel< 1 > *dist)
set model dist for dimension dim
Definition: ProductModel.h:183
~ProductModel() override
destructor
Definition: ProductModel.h:115
ProductModel(const ProductModel &source)
copy constructor
Definition: ProductModel.h:97
void getSamples(SamplesType &cont) const override
get reasonable set of samples from the model (i.e. for printing)
Definition: ProductModel.h:225
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: ProductModel.h:262
double IntensityType
Definition: ProductModel.h:72
static const String getProductName()
Returns the name of the model.
Definition: ProductModel.h:171
A more convenient string class.
Definition: String.h:61
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:120
Class for product models i.e. models with D independent dimensions.
Definition: ProductModel.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47