21#include "EvtGenBase/EvtPatches.hh"
25#include "EvtGenBase/EvtComplex.hh"
26#include "EvtGenBase/EvtSpinDensity.hh"
27#include "EvtGenBase/EvtAmp.hh"
28#include "EvtGenBase/EvtReport.hh"
29#include "EvtGenBase/EvtId.hh"
30#include "EvtGenBase/EvtPDL.hh"
31#include "EvtGenBase/EvtParticle.hh"
48 _pstates=amp._pstates;
49 for(i=0;i<_ndaug;i++){
50 dstates[i]=amp.dstates[i];
51 _dnontrivial[i]=amp._dnontrivial[i];
53 _nontrivial=amp._nontrivial;
57 for(i=0;i<_nontrivial;i++){
58 _nstate[i]=amp._nstate[i];
73 int daug_states[100],parstates;
74 for(ichild=0;ichild<ndaugs;ichild++){
83 setNState(parstates,daug_states);
90void EvtAmp::setNDaug(
int n){
94void EvtAmp::setNState(
int parent_states,
int *daug_states){
97 _pstates=parent_states;
100 _nstate[_nontrivial]=_pstates;
106 for(i=0;i<_ndaug;i++){
107 dstates[i]=daug_states[i];
109 if(daug_states[i]>1) {
110 _nstate[_nontrivial]=daug_states[i];
111 _dnontrivial[i]=_nontrivial;
117 report(
ERROR,
"EvtGen") <<
"Too many nontrivial states in EvtAmp!"<<endl;
125 int position = ind[0];
127 for (
int i=1; i<_nontrivial; i++ ) {
128 nstatepad *= _nstate[i-1];
129 position += nstatepad*ind[i];
138 int position = ind[0];
140 for (
int i=1; i<_nontrivial; i++ ) {
141 nstatepad *= _nstate[i-1];
142 position += nstatepad*ind[i];
145 return _amp[position];
160 if (_nontrivial==0) {
162 rho.
Set(0,0,_amp[0]*
conj(_amp[0]));
171 for(i=0;i<_nontrivial;i++){
176 temp+=_amp[i]*
conj(_amp[i]);
187 for(i=0;i<_pstates;i++){
188 for(j=0;j<_pstates;j++){
195 for (kk=0;kk<(_nontrivial-1); kk++ ) {
196 allloop *= dstates[kk];
199 for (kk=0; kk<allloop; kk++) {
200 temp += _amp[_pstates*kk+i]*
conj(_amp[_pstates*kk+j]);}
233 for(k=0;k<_ndaug;k++){
236 ampprime=ampprime.
contract(_dnontrivial[k],rho_list[k+1]);
240 return ampprime.
contract(0,(*
this));
266 ampprime=ampprime.
contract(0,rho_list[0]);
272 ampprime=ampprime.
contract(_dnontrivial[k],rho_list[k+1]);
277 return ampprime.
contract(_dnontrivial[i],(*
this));
287 temp._pstates=_pstates;
288 temp._nontrivial=_nontrivial;
290 for(i=0;i<_ndaug;i++){
291 temp.dstates[i]=dstates[i];
292 temp._dnontrivial[i]=_dnontrivial[i];
295 if (_nontrivial==0) {
296 report(
ERROR,
"EvtGen")<<
"Should not be here EvtAmp!"<<endl;
300 for(i=0;i<_nontrivial;i++){
301 temp._nstate[i]=_nstate[i];
314 for (i=0;i<_nontrivial;i++) {
315 allloop *= _nstate[i];
318 for ( i=0;i<allloop;i++) {
321 int tempint = index[k];
322 for (j=0;j<_nstate[k];j++) {
331 for ( ii=0;ii<_nontrivial;ii++) {
332 if ( indflag == 0 ) {
333 if ( index[ii] == (_nstate[ii]-1) ) {
360 for (i=0;i<_nontrivial;i++) {
361 allloop *= _nstate[i];
367 for(i=0;i<_nstate[k];i++){
369 for(j=0;j<_nstate[k];j++){
370 if (_nontrivial==0) {
371 report(
ERROR,
"EvtGen")<<
"Should not be here1 EvtAmp!"<<endl;
376 for (ii=0;ii<10;ii++) {
385 for ( l=0;l<int(allloop/_nstate[k]);l++) {
389 for ( ii=0;ii<_nontrivial;ii++) {
391 if ( indflag == 0 ) {
392 if ( index[ii] == (_nstate[ii]-1) ) {
416 assert(a2._pstates>1&&a2._nontrivial==1);
419 report(
DEBUG,
"EvtGen") <<
"EvtAmp::contract not written yet" << endl;
429 report(
DEBUG,
"EvtGen") <<
"Number of daugthers:"<<_ndaug<<endl;
430 report(
DEBUG,
"EvtGen") <<
"Number of states of the parent:"<<_pstates<<endl;
431 report(
DEBUG,
"EvtGen") <<
"Number of states on daughters:";
432 for (i=0;i<_ndaug;i++){
436 report(
DEBUG,
"EvtGen") <<
"Nontrivial index of daughters:";
437 for (i=0;i<_ndaug;i++){
441 report(
DEBUG,
"EvtGen") <<
"number of nontrivial states:"<<_nontrivial<<endl;
442 report(
DEBUG,
"EvtGen") <<
"Nontrivial particles number of states:";
443 for (i=0;i<_nontrivial;i++){
455 for (i=0;i<_nontrivial;i++) {
457 allloop[i] *= _nstate[i];
460 allloop[i] = allloop[i-1]*_nstate[i];
464 for (i=0;i<allloop[_nontrivial-1];i++) {
466 if ( i==allloop[index]-1 ) {
472 report(
DEBUG,
"EvtGen") <<
"-----------------------------------"<<endl;
515 _pstates=amp._pstates;
516 for(i=0;i<_ndaug;i++){
517 dstates[i]=amp.dstates[i];
518 _dnontrivial[i]=amp._dnontrivial[i];
520 _nontrivial=amp._nontrivial;
524 for(i=0;i<_nontrivial;i++){
525 _nstate[i]=amp._nstate[i];
Evt3Rank3C conj(const Evt3Rank3C &t2)
ostream & report(Severity severity, const char *facility)
const EvtComplex & getAmp(int *ind) const
EvtSpinDensity contract(int i, const EvtAmp &a)
void setAmp(int *ind, const EvtComplex &)
void vertex(const EvtComplex &)
void init(EvtId p, int ndaug, EvtId *daug)
EvtSpinDensity getBackwardSpinDensity(EvtSpinDensity *rho_list)
EvtSpinDensity getForwardSpinDensity(EvtSpinDensity *rho_list, int k)
EvtSpinDensity getSpinDensity()
EvtAmp & operator=(const EvtAmp &)
static EvtSpinType::spintype getSpinType(EvtId i)
const EvtComplex & Get(int i, int j) const
void Set(int i, int j, const EvtComplex &rhoij)
static int getSpinStates(spintype stype)