BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAmplitudeSum< T > Class Template Reference

#include <EvtAmplitudeSum.hh>

+ Inheritance diagram for EvtAmplitudeSum< T >:

Public Member Functions

 EvtAmplitudeSum ()
 
 EvtAmplitudeSum (const EvtAmplitudeSum< T > &other)
 
virtual ~EvtAmplitudeSum ()
 
virtual EvtAmplitude< T > * clone () const
 
void addTerm (EvtComplex c, const EvtAmplitude< T > &amp)
 
void addOwnedTerm (EvtComplex c, EvtAmplitude< T > *amp)
 
int nTerms () const
 
void print () const
 
EvtComplex c (int i) const
 
EvtAmplitude< T > * getTerm (int i) const
 
- Public Member Functions inherited from EvtAmplitude< T >
 EvtAmplitude ()
 
 EvtAmplitude (const EvtAmplitude &)
 
virtual ~EvtAmplitude ()
 
virtual EvtAmplitude< T > * clone () const =0
 
EvtComplex evaluate (const T &p) const
 

Protected Member Functions

virtual EvtComplex amplitude (const T &p) const
 
virtual EvtComplex amplitude (const T &) const =0
 

Detailed Description

template<class T>
class EvtAmplitudeSum< T >

Definition at line 19 of file EvtAmplitudeSum.hh.

Constructor & Destructor Documentation

◆ EvtAmplitudeSum() [1/2]

template<class T >
EvtAmplitudeSum< T >::EvtAmplitudeSum ( )
inline

Definition at line 23 of file EvtAmplitudeSum.hh.

23{}

◆ EvtAmplitudeSum() [2/2]

template<class T >
EvtAmplitudeSum< T >::EvtAmplitudeSum ( const EvtAmplitudeSum< T > &  other)
inline

Definition at line 24 of file EvtAmplitudeSum.hh.

25 : EvtAmplitude<T>(other)
26 {
27 int i;
28 for(i=0;i<other.nTerms();i++) {
29
30 EvtComplex c = other.c(i);
31 _c.push_back(c);
32 EvtAmplitude<T>* amp = other.getTerm(i);
33 assert(amp);
34 EvtAmplitude<T>* amp1 = amp->clone();
35 assert(amp1);
36 _term.push_back(amp1);
37 }
38 }
EvtComplex c(int i) const
virtual EvtAmplitude< T > * clone() const =0
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~EvtAmplitudeSum()

template<class T >
virtual EvtAmplitudeSum< T >::~EvtAmplitudeSum ( )
inlinevirtual

Definition at line 40 of file EvtAmplitudeSum.hh.

41 {
42 int i;
43 for(i=0;i<_term.size();i++) {
44
45 delete _term[i];
46 }
47 }

Member Function Documentation

◆ addOwnedTerm()

template<class T >
void EvtAmplitudeSum< T >::addOwnedTerm ( EvtComplex  c,
EvtAmplitude< T > *  amp 
)
inline

Definition at line 61 of file EvtAmplitudeSum.hh.

62 {
63 assert(amp);
64 _c.push_back(c);
65 _term.push_back(amp);
66 }

Referenced by EvtPto3PAmpFactory::processAmp().

◆ addTerm()

template<class T >
void EvtAmplitudeSum< T >::addTerm ( EvtComplex  c,
const EvtAmplitude< T > &  amp 
)
inline

Definition at line 55 of file EvtAmplitudeSum.hh.

56 {
57 _c.push_back(c);
58 _term.push_back(amp.clone());
59 }

◆ amplitude()

template<class T >
virtual EvtComplex EvtAmplitudeSum< T >::amplitude ( const T &  p) const
inlineprotectedvirtual

Implements EvtAmplitude< T >.

Definition at line 87 of file EvtAmplitudeSum.hh.

88 {
89 if(_term.size() == 0)
90 printf("Warning: amplitude sum has zero terms\n");
91
92 EvtComplex value = 0.;
93 int i;
94 for(i=0;i<_term.size();i++) {
95
96 value+=_c[i]*_term[i]->evaluate(p);
97 }
98 return value;
99 }

◆ c()

template<class T >
EvtComplex EvtAmplitudeSum< T >::c ( int  i) const
inline

◆ clone()

template<class T >
virtual EvtAmplitude< T > * EvtAmplitudeSum< T >::clone ( ) const
inlinevirtual

Implements EvtAmplitude< T >.

Definition at line 49 of file EvtAmplitudeSum.hh.

50 {
51 return new EvtAmplitudeSum<T>(*this);
52 }

◆ getTerm()

template<class T >
EvtAmplitude< T > * EvtAmplitudeSum< T >::getTerm ( int  i) const
inline

Definition at line 83 of file EvtAmplitudeSum.hh.

83{ return _term[i]; }

◆ nTerms()

template<class T >
int EvtAmplitudeSum< T >::nTerms ( ) const
inline

Definition at line 68 of file EvtAmplitudeSum.hh.

68{ return _term.size(); } // number of terms

Referenced by EvtAmplitudeSum< T >::print().

◆ print()

template<class T >
void EvtAmplitudeSum< T >::print ( ) const
inline

Definition at line 70 of file EvtAmplitudeSum.hh.

70 {
71
72 int N = nTerms();
73 printf("Amplitude has %d terms\n",N);
74 int i;
75 for(i=0;i<N;i++) {
76 printf("c%d = (%f,%f)\n",i,real(_c[i]),imag(_c[i]));
77 assert(_term[i]);
78 }
79 }
double imag(const EvtComplex &c)
Definition: EvtComplex.hh:246
int nTerms() const

The documentation for this class was generated from the following file: