BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtSpinAmp.hh
Go to the documentation of this file.
1#ifndef __EVTSPINAMP_HH__
2#define __EVTSPINAMP_HH__
3
6
7#include <vector>
8using std::vector;
9
10#include <cstdarg>
11
12class EvtSpinAmp;
16
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 );
31 EvtSpinAmp( const EvtSpinAmp & );
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
43 EvtSpinAmp operator+( const EvtSpinAmp& ) const;
45
46 EvtSpinAmp operator-( const EvtSpinAmp& ) const;
48
49 // Direct Product
50 EvtSpinAmp operator*( const EvtSpinAmp& ) const;
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 &)
Definition: EvtSpinAmp.cc:25
EvtSpinAmp operator/(const EvtSpinAmp &, const EvtComplex &)
Definition: EvtSpinAmp.cc:41
EvtComplex & operator()(const vector< int > &)
Definition: EvtSpinAmp.cc:168
EvtSpinAmp & operator-=(const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:289
EvtSpinAmp & operator=(const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:246
vector< int > iterinit() const
Definition: EvtSpinAmp.cc:359
friend std::ostream & operator<<(std::ostream &, const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:9
void assign(const EvtComplex &val)
Definition: EvtSpinAmp.hh:61
bool iterate(vector< int > &index) const
Definition: EvtSpinAmp.cc:369
void addspin(int twospin)
Definition: EvtSpinAmp.hh:71
friend EvtSpinAmp operator*(const EvtComplex &, const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:25
bool iterateallowed(vector< int > &index) const
Definition: EvtSpinAmp.cc:411
EvtSpinAmp & operator*=(const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:336
EvtSpinAmp operator+(const EvtSpinAmp &) const
Definition: EvtSpinAmp.cc:255
int rank() const
Definition: EvtSpinAmp.hh:64
vector< int > iterallowedinit() const
Definition: EvtSpinAmp.cc:421
EvtSpinAmp & operator+=(const EvtSpinAmp &)
Definition: EvtSpinAmp.cc:267
bool allowed(const vector< int > &index) const
Definition: EvtSpinAmp.cc:386
void setelem(const vector< EvtComplex > &elem)
Definition: EvtSpinAmp.hh:72
EvtSpinAmp & operator/=(const EvtComplex &)
Definition: EvtSpinAmp.cc:351
friend EvtSpinAmp operator/(const EvtSpinAmp &, const EvtComplex &)
Definition: EvtSpinAmp.cc:41
void intcont(int, int)
Definition: EvtSpinAmp.cc:431
void extcont(const EvtSpinAmp &, int, int)
Definition: EvtSpinAmp.cc:489
EvtSpinAmp operator-(const EvtSpinAmp &) const
Definition: EvtSpinAmp.cc:278
const vector< int > & dims() const
Definition: EvtSpinAmp.hh:67