ROOTPWA
TPWAAmp.h
Go to the documentation of this file.
1 
2 //
3 // Copyright 2009 Sebastian Neubert
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // rootpwa is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 
22 //-----------------------------------------------------------
23 // File and Version Information:
24 // $Id$
25 //
26 // Description:
27 // A class to encapsulate PWA production amplitudes
28 //
29 //
30 // Environment:
31 // ROOTPWA
32 //
33 // Author List:
34 // Sebastian Neubert TUM (original author)
35 //
36 //
37 //-----------------------------------------------------------
38 
39 #ifndef TPWAAMP_HH
40 #define TPWAAMP_HH
41 
42 // Base Class Headers ----------------
43 
44 
45 // Collaborating Class Headers -------
46 #include <ostream> // remove if you do not need streaming op
47 #include <string>
48 #include <complex>
49 #include "TPWAConstraint.h"
50 #include "TPWARealConstraint.h"
51 
52 using std::string;
53 using std::complex;
54 
55 // Collaborating Class Declarations --
56 
57 class TPWAAmp {
58 public:
59 
60  // Constructors/Destructors ---------
61  TPWAAmp(string name, int rank,
62  double threshold=0,
63  unsigned int normindex=0,
64  unsigned int accindex=0);
65  TPWAAmp(const TPWAAmp&); // nontrivial CPCTOR! deep copy constraint!
66  ~TPWAAmp();
67 
68  void operator =(const TPWAAmp&);
69 
70  // Operators
71  friend std::ostream& operator<< (std::ostream& s, const TPWAAmp& me);
72 
73  // Arithmetic operators
74  friend complex<double> operator*(TPWAAmp& lhs, TPWAAmp& rhs);
75  friend complex<double> operator*(TPWAAmp& lhs, const complex<double>& rhs);
76  friend complex<double> operator*(const complex<double>& lhs, TPWAAmp& rhs);
77 
78  // Accessors -----------------------
79  string name() const {return _name;}
80  string parname(unsigned int i) const; // return paramter name
81  // i=0,1 Real/imaginary
82  double threshold() const {return _threshold;}
83  string type() const;
84  double par(unsigned int i) const; // returns parameter (w/o constraint)
85  const complex<double>& amp() const; // returns cached amplitude
86  // (takes into account evtl. constraints)
87  // derivative of amp wrt parameter i:
88  complex<double> dampdpar(unsigned int i) const;
89 
90  complex<double> updateAmp();
91 
92  int rank() const {return _rank;}
93  int reflectivity() const {return _reflectivity;}
94 
95  int npar() const ; // returns number of parameters 2,1,0 depends on constraint
96  unsigned int normindex() const {return _integralindex;}
97  unsigned int accindex() const {return _acceptanceindex;}
98  // index of normalization integral
99 
100 
101  // Modifiers -----------------------
102  // returns amplitude with contraints!
103  complex<double> setPar(double* par); // recalculates and caches amp
104  void setIntegralIndices(unsigned int inorm, unsigned int iacc)
105  {_integralindex=inorm;_acceptanceindex=iacc;}
106 
107 
108  // Operations ----------------------
109  // recalculates and caches amp
110  void setConstraint(TPWAConstraint* c);
111 
112  private:
113 
114  // Private Data Members ------------
115  string _name;
117  int _rank;
118  double _threshold;
119  complex<double> _amp;
120  complex<double> _cached;
121  // indices in normalization/acceptance integral
122  unsigned int _integralindex;
123  unsigned int _acceptanceindex;
124 
125  // a constraint is called by the object and
126  // alters the amplitude. This usually reduces the
127  // number of free parameters
129 
130  // Private Methods -----------------
131 
132 };
133 
134 #endif
135 
136 //--------------------------------------------------------------
137 // $Log$
138 //--------------------------------------------------------------