BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinAmp.hh
Go to the documentation of this file.
1#ifndef __EVTSPINAMP_HH__
2#define __EVTSPINAMP_HH__
3
4#include "EvtGenBase/EvtSpinType.hh"
5#include "EvtGenBase/EvtComplex.hh"
6
7#include <vector>
8using std::vector;
9
10#include <cstdarg>
11
12class EvtSpinAmp;
16
17class EvtSpinAmp
18{
19
20 friend EvtSpinAmp operator*( const EvtComplex&, const EvtSpinAmp& );
21 friend EvtSpinAmp operator*( const EvtSpinAmp&, const EvtComplex& );
22 friend EvtSpinAmp operator/( const EvtSpinAmp&, const EvtComplex& );
23 friend std::ostream& operator<< ( std::ostream&, const EvtSpinAmp& );
24
25public:
26
28 EvtSpinAmp( const vector<EvtSpinType::spintype>& twospin );
29 EvtSpinAmp( const vector<EvtSpinType::spintype>& twospin, const EvtComplex& val );
30 EvtSpinAmp( const vector<EvtSpinType::spintype>& twospin, const vector<EvtComplex>& elem );
32
34
35 // Input to the index functions are twice the magnetic quantum number
36 EvtComplex& operator()( const vector<int>& );
37 const EvtComplex& operator()( const vector<int>& ) const;
38 EvtComplex& operator()( int, ... );
39 const EvtComplex& operator()( int, ... ) const;
40
42
45
48
49 // Direct Product
52
55
56 // Contraction of amplitudes
57 void intcont( int, int );
58 void extcont( const EvtSpinAmp &, int, int );
59
60 // assign this value to every member in the container
61 void assign( const EvtComplex & val ) { _elem.assign( _elem.size(), val ); }
62
63 // get the order of the container
64 int rank( ) const { return _twospin.size(); }
65
66 // get the dimension vector of the container
67 const vector<int> & dims( ) const { return _twospin; }
68
69 // set the elements and the dimensions of the vector - useful for something
70 // things eventough it is usually not the cleanest solution
71 void addspin( int twospin ) { _twospin.push_back( twospin ); }
72 void setelem( const vector<EvtComplex> &elem ) { _elem = elem; }
73
74 bool iterate( vector<int>& index ) const;
75 vector<int> iterinit() const;
76
77 bool allowed( const vector<int>& index ) const;
78 bool iterateallowed( vector<int>& index) const;
79 vector<int> iterallowedinit() const;
80
81private:
82
83 void checkindexargs( const vector<int>& index ) const;
84 void checktwospin( const vector<int>& twospin ) const;
85 int findtrueindex( const vector<int>& index ) const;
86 vector<int> calctwospin( const vector<EvtSpinType::spintype>& type ) const;
87
88 vector<EvtSpinType::spintype> _type;
89 vector<int> _twospin;
90 vector<EvtComplex> _elem;
91};
92
93#endif // __EVTSPINAMP__
EvtSpinAmp operator*(const EvtComplex &, const EvtSpinAmp &)
EvtSpinAmp operator/(const EvtSpinAmp &, const EvtComplex &)
EvtComplex & operator()(const vector< int > &)
EvtSpinAmp & operator-=(const EvtSpinAmp &)
EvtSpinAmp & operator=(const EvtSpinAmp &)
vector< int > iterinit() const
friend std::ostream & operator<<(std::ostream &, const EvtSpinAmp &)
EvtComplex & operator()(int,...)
EvtSpinAmp(const vector< EvtSpinType::spintype > &twospin, const EvtComplex &val)
const EvtComplex & operator()(const vector< int > &) const
bool iterate(vector< int > &index) const
friend EvtSpinAmp operator*(const EvtComplex &, const EvtSpinAmp &)
bool iterateallowed(vector< int > &index) const
EvtSpinAmp & operator*=(const EvtSpinAmp &)
EvtSpinAmp operator+(const EvtSpinAmp &) const
EvtSpinAmp(const vector< EvtSpinType::spintype > &twospin, const vector< EvtComplex > &elem)
vector< int > iterallowedinit() const
EvtSpinAmp & operator+=(const EvtSpinAmp &)
EvtSpinAmp(const EvtSpinAmp &)
EvtSpinAmp operator*(const EvtSpinAmp &) const
bool allowed(const vector< int > &index) const
void setelem(const vector< EvtComplex > &elem)
const EvtComplex & operator()(int,...) const
EvtSpinAmp & operator/=(const EvtComplex &)
friend EvtSpinAmp operator/(const EvtSpinAmp &, const EvtComplex &)
void intcont(int, int)
void extcont(const EvtSpinAmp &, int, int)
EvtSpinAmp(const vector< EvtSpinType::spintype > &twospin)
EvtSpinAmp operator-(const EvtSpinAmp &) const
EvtSpinAmp & operator*=(const EvtComplex &)