1 #ifndef __EVTSPINAMP_HH__
2 #define __EVTSPINAMP_HH__
4 #include "EvtGenBase/EvtSpinType.hh"
5 #include "EvtGenBase/EvtComplex.hh"
13 EvtSpinAmp operator*( const EvtComplex&, const EvtSpinAmp& );
14 EvtSpinAmp operator*( const EvtSpinAmp&, const EvtComplex& );
15 EvtSpinAmp operator/( const EvtSpinAmp&, const EvtComplex& );
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& );
28 EvtSpinAmp( const vector<EvtSpinType::spintype>& );
29 EvtSpinAmp( const vector<EvtSpinType::spintype>& , const EvtComplex& );
30 EvtSpinAmp( const vector<EvtSpinType::spintype>& , const vector<EvtComplex>& );
31 EvtSpinAmp( const EvtSpinAmp & );
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;
41 EvtSpinAmp& operator=( const EvtSpinAmp& );
43 EvtSpinAmp operator+( const EvtSpinAmp& ) const;
44 EvtSpinAmp& operator+=( const EvtSpinAmp& );
46 EvtSpinAmp operator-( const EvtSpinAmp& ) const;
47 EvtSpinAmp& operator-=( const EvtSpinAmp& );
50 EvtSpinAmp operator*( const EvtSpinAmp& ) const;
51 EvtSpinAmp& operator*=( const EvtSpinAmp& );
53 EvtSpinAmp& operator*=( const EvtComplex& );
54 EvtSpinAmp& operator/=( const EvtComplex& );
56 // Contraction of amplitudes
57 void intcont( size_t, size_t );
58 void extcont( const EvtSpinAmp &, int, int );
60 // assign this value to every member in the container
61 void assign( const EvtComplex & val ) { _elem.assign( _elem.size(), val ); }
63 // get the order of the container
64 size_t rank( ) const { return _twospin.size(); }
66 // get the dimension vector of the container
67 const vector<unsigned int> & dims( ) const { return _twospin; }
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; }
74 bool iterate( vector<int>& index ) const;
75 vector<int> iterinit() const;
77 bool allowed( const vector<int>& index ) const;
78 bool iterateallowed( vector<int>& index) const;
79 vector<int> iterallowedinit() const;
83 void checkindexargs( const vector<int>& index ) const;
84 void checktwospin( const vector<unsigned int>& twospin ) const;
85 int findtrueindex( const vector<int>& index ) const;
86 vector<unsigned int> calctwospin( const vector<EvtSpinType::spintype>& type ) const;
88 vector<EvtSpinType::spintype> _type;
89 vector<unsigned int> _twospin;
90 vector<EvtComplex> _elem;
93 #endif // __EVTSPINAMP__