50 distributions_(D, nullptr)
52 this->setName(this->getProductName());
55 for (
UInt dim = 0; dim < D; ++dim)
58 this->subsections_.push_back(name);
59 this->defaults_.setValue(name,
"GaussModel",
"Name of the model used for this dimension");
63 this->defaults_.setValue(
"intensity_scaling", 1.0,
"Scaling factor used to adjust the model distribution to the intensities of the data");
64 this->defaultsToParam_();
70 distributions_(D, nullptr),
73 for (
UInt dim = 0; dim < D; ++dim)
76 if (source.distributions_[dim])
88 for (
Size dim = 0; dim < D; ++dim)
90 delete distributions_[dim];
97 if (&source ==
this)
return *
this;
100 scale_ = source.scale_;
102 for (
UInt dim = 0; dim < D; ++dim)
104 if (source.distributions_[dim])
112 distributions_[dim] =
nullptr;
124 for (
UInt dim = 0; dim < D; ++dim)
126 if (distributions_[dim] ==
nullptr)
130 intens *= distributions_[dim]->getIntensity(pos[dim]);
144 return String(
"ProductModel") + D +
"D";
157 if (dist ==
nullptr || dist == distributions_[dim])
162 delete distributions_[dim];
163 distributions_[dim] = dist;
167 this->param_.removeAll(name +
':');
168 this->param_.insert(name +
':', distributions_[dim]->getParameters());
169 this->param_.setValue(name, distributions_[dim]->getName());
177 return distributions_[dim];
189 this->setCutOff(this->getCutOff() / scale_);
191 this->param_.setValue(
"intensity_scaling", scale);
192 this->setCutOff(this->getCutOff() * scale_);
200 std::vector<Samples1D> samples(D);
202 for (
Size dim = 0; dim < D; ++dim)
204 distributions_[dim]->getSamples(samples[dim]);
208 std::vector<UInt> i(D, 0);
210 while (i[D - 1] < samples[D - 1].size())
212 for (
UInt dim = 0; dim < D; ++dim)
214 peak.getPosition()[dim] = samples[dim][i[dim]].getPosition()[0];
217 cont.push_back(peak);
220 for (
Size dim = 0; dim < D - 1; ++dim)
222 if (i[dim] >= samples[dim].size())
236 scale_ = (double)(this->param_.getValue(
"intensity_scaling"));
237 for (
UInt dim = 0; dim < D; ++dim)
240 if (this->param_.exists(name))
242 delete distributions_[dim];
244 Param copy = this->param_.
copy(name +
":",
true);
245 distributions_[dim]->setParameters(copy);
246 if (distributions_[dim]->getName().
hasSubstring(
"IsotopeModel"))
Abstract base class for all D-dimensional models.
Definition: BaseModel.h:25
DPeak< D >::Type PeakType
Definition: BaseModel.h:30
BaseModel & operator=(const BaseModel &source)
assignment operator
Definition: BaseModel.h:51
std::vector< PeakType > SamplesType
Definition: BaseModel.h:31
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: BaseModel.h:126
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:29
Exception base class.
Definition: Exception.h:63
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:37
Definition: IsotopeModel.h:34
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:28
BaseModel< D > * createModel()
Definition: ModelDescription.h:70
Management and storage of parameters / INI files.
Definition: Param.h:44
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:181
std::vector< BaseModel< 1 > * > distributions_
Definition: ProductModel.h:254
IntensityType scale_
Definition: ProductModel.h:255
DPosition< D > PositionType
Definition: ProductModel.h:44
BaseModel< D >::SamplesType SamplesType
Definition: ProductModel.h:45
ProductModel()
Default constructor.
Definition: ProductModel.h:48
void setScale(IntensityType scale)
set the intensity scaling factor
Definition: ProductModel.h:187
static BaseModel< D > * create()
create new ProductModel object (needed by Factory)
Definition: ProductModel.h:136
virtual ProductModel & operator=(const ProductModel &source)
assignment operator
Definition: ProductModel.h:95
BaseModel< 1 > * getModel(UInt dim) const
Definition: ProductModel.h:174
IntensityType getIntensity(const PositionType &pos) const override
intensity equals product of intensities in each dimension
Definition: ProductModel.h:121
ProductModel & setModel(UInt dim, BaseModel< 1 > *dist)
set model dist for dimension dim
Definition: ProductModel.h:154
~ProductModel() override
destructor
Definition: ProductModel.h:86
ProductModel(const ProductModel &source)
copy constructor
Definition: ProductModel.h:68
void getSamples(SamplesType &cont) const override
get reasonable set of samples from the model (i.e. for printing)
Definition: ProductModel.h:196
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: ProductModel.h:233
double IntensityType
Definition: ProductModel.h:43
static const String getProductName()
Returns the name of the model.
Definition: ProductModel.h:142
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:94
Class for product models i.e. models with D independent dimensions.
Definition: ProductModel.h:31
static bool hasSubstring(const String &this_s, const String &string)
Definition: StringUtilsSimple.h:112
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19