laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauAbsCoeffSet.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2006 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
15 #include <iostream>
16 
17 #include "TString.h"
18 
19 #include "LauAbsCoeffSet.hh"
20 #include "LauConstants.hh"
21 #include "LauParameter.hh"
22 
24 
25 Double_t LauAbsCoeffSet::minMagnitude_ = -10.0;
26 Double_t LauAbsCoeffSet::maxMagnitude_ = 10.0;
29 Double_t LauAbsCoeffSet::minRealImagPart_ = -10.0;
30 Double_t LauAbsCoeffSet::maxRealImagPart_ = 10.0;
31 Double_t LauAbsCoeffSet::minDelta_ = -2.0;
32 Double_t LauAbsCoeffSet::maxDelta_ = 2.0;
33 
34 LauAbsCoeffSet::LauAbsCoeffSet(const TString& theName, const TString& theBaseName) :
35  name_(theName),
36  basename_(theBaseName),
37  index_(0)
38 {
39 }
40 
42  name_(rhs.name_),
43  basename_(rhs.basename_),
44  index_(rhs.index_)
45 {
46 }
47 
49 {
50  if ( &rhs != this ) {
51  name_ = rhs.name_;
52  basename_ = rhs.basename_;
53  index_ = rhs.index_;
54  }
55  return *this;
56 }
57 
58 void LauAbsCoeffSet::index(UInt_t newIndex)
59 {
60  index_ = newIndex;
61 
62  TString basename( this->baseName() );
63  if ( basename.Length() != 1 ) {
64  basename.Remove(1);
65  }
66  basename += newIndex;
67  basename += "_";
68  this->baseName(basename);
69 
70  std::vector<LauParameter*> pars = this->getParameters();
71  for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
72  this->adjustName( *iter );
73  }
74 }
75 
77 {
78  TString theName(par->name());
79  theName.Remove(0,theName.Index("_")+1);
80  theName.Prepend(this->baseName());
81  par->name(theName);
82 }
83 
84 void LauAbsCoeffSet::setParameterValue(const TString& parName, Double_t value, Bool_t init)
85 {
86  LauParameter* par = this->findParameter( parName );
87  if ( par == 0 ) {
88  std::cerr << "ERROR in LauAbsCoeffSet::setParameterValue : Unable to find parameter \"" << parName << "\"" << std::endl;
89  return;
90  }
91 
92  par->value( value );
93  if ( init ) {
94  par->genValue( value );
95  par->initValue( value );
96  }
97 }
98 
99 void LauAbsCoeffSet::fixParameter(const TString& parName)
100 {
101  LauParameter* par = this->findParameter( parName );
102  if ( par == 0 ) {
103  std::cerr << "ERROR in LauAbsCoeffSet::fixParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
104  return;
105  }
106 
107  par->fixed( kTRUE );
108 }
109 
110 void LauAbsCoeffSet::floatParameter(const TString& parName)
111 {
112  LauParameter* par = this->findParameter( parName );
113  if ( par == 0 ) {
114  std::cerr << "ERROR in LauAbsCoeffSet::floatParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
115  return;
116  }
117 
118  par->fixed( kFALSE );
119 }
120 
122 {
123  std::vector<LauParameter*> pars = this->getParameters();
124  for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
125 
126  const TString& iName = (*iter)->name();
127 
128  if ( iName.EndsWith( parName ) ) {
129  return (*iter);
130  }
131  }
132 
133  return 0;
134 }
135 
static Double_t maxPhase_
Maximum allowed value of phase parameters.
Bool_t fixed() const
Check whether the parameter is fixed or floated.
static Double_t minDelta_
Minimum allowed value of CP-violating real/imaginary part parameters.
ClassImp(LauAbsCoeffSet)
virtual void setParameterValue(const TString &parName, Double_t value, Bool_t init)
Set the value of the named parameter.
const TString & name() const
The parameter name.
File containing declaration of LauAbsCoeffSet class.
static Double_t maxRealImagPart_
Maximum allowed value of real/imaginary part parameters.
static Double_t maxDelta_
Maximum allowed value of CP-violating real/imaginary part parameters.
LauAbsCoeffSet & operator=(const LauAbsCoeffSet &rhs)
Copy assignment operator.
UInt_t index_
The index number of the coefficient set.
virtual void fixParameter(const TString &parName)
Set the named parameter to be fixed in the fit.
LauParameter * findParameter(const TString &parName)
Find the parameter with the given name.
virtual UInt_t index() const
Retrieve the index number of the coefficient set.
const Double_t threePi
Three times Pi.
Definition: LauConstants.hh:95
static Double_t maxMagnitude_
Maximum allowed value of magnitude parameters.
File containing declaration of LauParameter class.
TString basename_
The base name of the coefficient set.
Class for defining the abstract interface for complex coefficient classes.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:34
static Double_t minRealImagPart_
Minimum allowed value of real/imaginary part parameters.
TString name_
The parameter name.
Double_t initValue() const
The initial value of the parameter.
File containing LauConstants namespace.
virtual void floatParameter(const TString &parName)
Set the named parameter to float in the fit.
static Double_t minPhase_
Minimum allowed value of phase parameters.
Double_t value() const
The value of the parameter.
virtual std::vector< LauParameter * > getParameters()=0
Retrieve the parameters of the coefficient so that they can be loaded into a fit. ...
static Double_t minMagnitude_
Minimum allowed value of magnitude parameters.
virtual const TString & baseName() const
Retrieve the base name of the coefficient set.
void adjustName(LauParameter *par)
Prepend the base name and index to the name of a parameter.
Double_t genValue() const
The value generated for the parameter.
TString name_
The name of the coefficient set.
LauAbsCoeffSet(const TString &theName, const TString &theBaseName="A")
Constructor.