laura is hosted by Hepforge, IPPP Durham
Laura++  v2r1p1
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 
41 void LauAbsCoeffSet::index(UInt_t newIndex)
42 {
43  index_ = newIndex;
44 
45  TString basename( this->baseName() );
46  if ( basename.Length() != 1 ) {
47  basename.Remove(1);
48  }
49  basename += newIndex;
50  basename += "_";
51  this->baseName(basename);
52 
53  std::vector<LauParameter*> pars = this->getParameters();
54  for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
55  this->adjustName( *iter );
56  }
57 }
58 
60 {
61  TString theName(par->name());
62  theName.Remove(0,theName.Index("_")+1);
63  theName.Prepend(this->baseName());
64  par->name(theName);
65 }
66 
67 void LauAbsCoeffSet::setParameterValue(const TString& parName, Double_t value, Bool_t init)
68 {
69  LauParameter* par = this->findParameter( parName );
70  if ( par == 0 ) {
71  std::cerr << "ERROR in LauAbsCoeffSet::setParameterValue : Unable to find parameter \"" << parName << "\"" << std::endl;
72  return;
73  }
74 
75  par->value( value );
76  if ( init ) {
77  par->genValue( value );
78  par->initValue( value );
79  }
80 }
81 
82 void LauAbsCoeffSet::fixParameter(const TString& parName)
83 {
84  LauParameter* par = this->findParameter( parName );
85  if ( par == 0 ) {
86  std::cerr << "ERROR in LauAbsCoeffSet::fixParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
87  return;
88  }
89 
90  par->fixed( kTRUE );
91 }
92 
93 void LauAbsCoeffSet::floatParameter(const TString& parName)
94 {
95  LauParameter* par = this->findParameter( parName );
96  if ( par == 0 ) {
97  std::cerr << "ERROR in LauAbsCoeffSet::floatParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
98  return;
99  }
100 
101  par->fixed( kFALSE );
102 }
103 
105 {
106  std::vector<LauParameter*> pars = this->getParameters();
107  for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
108 
109  const TString& iName = (*iter)->name();
110 
111  if ( iName.EndsWith( parName ) ) {
112  return (*iter);
113  }
114  }
115 
116  return 0;
117 }
118 
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.
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.
Class for defining the abstract interface for complex coefficient classes.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:33
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.
LauAbsCoeffSet(const TString &theName, const TString &theBaseName="A")
Constructor.