36 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_PRODUCTMODEL_H 
   37 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_PRODUCTMODEL_H 
   82       this->setName(this->getProductName());
 
   85       for (
UInt dim = 0; dim < D; ++dim)
 
   88         this->subsections_.push_back(name);
 
   89         this->defaults_.setValue(name, 
"GaussModel", 
"Name of the model used for this dimension");
 
   93       this->defaults_.setValue(
"intensity_scaling", 1.0, 
"Scaling factor used to adjust the model distribution to the intensities of the data");
 
   94       this->defaultsToParam_();
 
  100       distributions_(D, 0),
 
  101       scale_(source.scale_)
 
  103       for (
UInt dim = 0; dim < D; ++dim)
 
  106         if (source.distributions_[dim])
 
  118       for (
Size dim = 0; dim < D; ++dim)
 
  120         delete distributions_[dim];
 
  127       if (&source == 
this) 
return *
this;
 
  130       scale_ = source.scale_;
 
  132       for (
UInt dim = 0; dim < D; ++dim)
 
  134         if (source.distributions_[dim])
 
  142           distributions_[dim] = 0;
 
  154       for (
UInt dim = 0; dim < D; ++dim)
 
  156         if (distributions_[dim] == 0)
 
  160         intens *= distributions_[dim]->getIntensity(pos[dim]);
 
  174       return String(
"ProductModel") + D + 
"D";
 
  187       if (dist == 0 || dist == distributions_[dim])
 
  192       delete distributions_[dim];
 
  193       distributions_[dim] = dist;
 
  197       this->param_.removeAll(name + 
':');
 
  198       this->param_.insert(name + 
':', distributions_[dim]->getParameters());
 
  199       this->param_.setValue(name, distributions_[dim]->getName());
 
  207       return distributions_[dim];
 
  219       this->setCutOff(this->getCutOff() / scale_);  
 
  221       this->param_.setValue(
"intensity_scaling", scale);
 
  222       this->setCutOff(this->getCutOff() * scale_);  
 
  230       std::vector<Samples1D> samples(D);
 
  232       for (
Size dim = 0; dim < D; ++dim)
 
  234         distributions_[dim]->getSamples(samples[dim]);
 
  238       std::vector<UInt> i(D, 0);  
 
  240       while (i[D - 1] < samples[D - 1].size())
 
  242         for (
UInt dim = 0; dim < D; ++dim)
 
  244           peak.getPosition()[dim] = samples[dim][i[dim]].getPosition()[0];
 
  247         cont.push_back(peak);
 
  250         for (
Size dim = 0; dim < D - 1; ++dim)
 
  252           if (i[dim] >= samples[dim].size())
 
  266       scale_ = (
double)(this->param_.getValue(
"intensity_scaling"));
 
  267       for (
UInt dim = 0; dim < D; ++dim)
 
  270         if (this->param_.exists(name))
 
  272           delete distributions_[dim];
 
  274           Param copy = this->param_.
copy(name + 
":", 
true);
 
  275           distributions_[dim]->setParameters(copy);
 
  276           if (distributions_[dim]->getName().hasSubstring(
"IsotopeModel"))
 
  278             static_cast<IsotopeModel *
>(distributions_[dim])->setSamples(static_cast<IsotopeModel *>(distributions_[dim])->getFormula());
 
  289 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_PRODUCTMODEL_H 
ProductModel & setModel(UInt dim, BaseModel< 1 > *dist)
set model dist for dimension dim 
Definition: ProductModel.h:184
A more convenient string class. 
Definition: String.h:56
ProductModel(const ProductModel &source)
copy constructor 
Definition: ProductModel.h:98
virtual ProductModel & operator=(const ProductModel &source)
assignment operator 
Definition: ProductModel.h:125
IntensityType getIntensity(const PositionType &pos) const 
intensity equals product of intensities in each dimension 
Definition: ProductModel.h:151
Isotope distribution approximated using linear interpolation. 
Definition: IsotopeModel.h:59
#define OPENMS_PRECONDITION(condition, message)
Precondition macro. 
Definition: Macros.h:107
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct. ...
Definition: Factory.h:62
IntensityType getScale() const 
return the intensity scaling factor 
Definition: ProductModel.h:211
DPosition< D > PositionType
Definition: ProductModel.h:74
Param copy(const String &prefix, bool remove_prefix=false) const 
Returns a new Param object containing all entries that start with prefix. 
BaseModel< D > * createModel()
Definition: ModelDescription.h:97
virtual void updateMembers_()
This method is used to update extra member variables at the end of the setParameters() method...
Definition: BaseModel.h:158
DoubleReal IntensityType
Definition: ProductModel.h:73
BaseModel< 1 > * getModel(UInt dim) const 
Definition: ProductModel.h:204
static char const * shortDimensionName(UInt const dim)
Short name of the dimension (abbreviated form) 
ProductModel()
Default constructor. 
Definition: ProductModel.h:78
BaseModel< D >::SamplesType SamplesType
Definition: ProductModel.h:75
Exception base class. 
Definition: Exception.h:90
void setScale(IntensityType scale)
set the intensity scaling factor 
Definition: ProductModel.h:217
Management and storage of parameters / INI files. 
Definition: Param.h:69
std::vector< BaseModel< 1 > * > distributions_
Definition: ProductModel.h:284
virtual ~ProductModel()
destructor 
Definition: ProductModel.h:116
Stores the name and parameters of a model. 
Definition: ModelDescription.h:54
IntensityType scale_
Definition: ProductModel.h:285
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
Class for product models i.e. models with D independent dimensions. 
Definition: ProductModel.h:61
Abstract base class for all D-dimensional models. 
Definition: BaseModel.h:51
void updateMembers_()
This method is used to update extra member variables at the end of the setParameters() method...
Definition: ProductModel.h:263
static const String getProductName()
Returns the name of the model. 
Definition: ProductModel.h:172
void getSamples(SamplesType &cont) const 
get reasonable set of samples from the model (i.e. for printing) 
Definition: ProductModel.h:226
std::vector< PeakType > SamplesType
Definition: BaseModel.h:61
virtual BaseModel & operator=(const BaseModel &source)
assignment operator 
Definition: BaseModel.h:84
DPeak< D >::Type PeakType
Definition: BaseModel.h:60
static BaseModel< D > * create()
create new ProductModel object (needed by Factory) 
Definition: ProductModel.h:166