JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
AnaMelaHelpers Namespace Reference

Functions

void multiplyComplexNumbers (std::vector< Double_t > const &reals, std::vector< Double_t > const &imags, Double_t &resRe, Double_t &resIm)
 

Function Documentation

◆ multiplyComplexNumbers()

void AnaMelaHelpers::multiplyComplexNumbers ( std::vector< Double_t > const &  reals,
std::vector< Double_t > const &  imags,
Double_t &  resRe,
Double_t &  resIm 
)

Definition at line 7 of file RooSpin.cc.

7  {
8  resRe=0; resIm=0;
9  const unsigned int nreals = reals.size();
10  const unsigned int nimags = imags.size();
11  const unsigned int nloops = pow(2, min(nreals, nimags));
12  const unsigned int nterms = max(nreals, nimags);
13 
14  for (unsigned int ic=0; ic<nloops; ic++){
15  Double_t termval=1;
16  unsigned int nimagsused=0;
17  bool doSkip=false;
18  for (unsigned int it=0; it<nterms; it++){
19  unsigned int code = (nreals>=nimags ? 0 : 1);
20  if (it<nloops) code = (ic >> it);
21  if (code%2==1){
22  nimagsused++;
23  termval*=imags.at(it);
24  }
25  else termval*=reals.at(it);
26  if (termval==0.){ doSkip=true; break; }
27  }
28  if (doSkip) continue;
29  if (nimagsused%4==0) resRe += termval;
30  else if (nimagsused%4==1) resIm += termval;
31  else if (nimagsused%4==2) resRe -= termval;
32  else resIm -= termval;
33  }
34 }