#include <EvtSpinDensity.hh>
Public Member Functions | |
EvtSpinDensity (const EvtSpinDensity &density) | |
EvtSpinDensity & | operator= (const EvtSpinDensity &density) |
virtual | ~EvtSpinDensity () |
EvtSpinDensity () | |
void | SetDim (int n) |
int | GetDim () const |
void | Set (int i, int j, const EvtComplex &rhoij) |
const EvtComplex & | Get (int i, int j) const |
double | NormalizedProb (const EvtSpinDensity &d) |
void | SetDiag (int n) |
int | Check () |
Private Attributes | |
EvtComplexPtrPtr | rho |
int | dim |
Friends | |
std::ostream & | operator<< (std::ostream &s, const EvtSpinDensity &d) |
Definition at line 27 of file EvtSpinDensity.hh.
EvtSpinDensity::EvtSpinDensity | ( | const EvtSpinDensity & | density | ) |
Definition at line 33 of file EvtSpinDensity.cc.
References dim, genRecEmupikp::i, ganga-rec::j, rho, and SetDim().
00033 { 00034 dim=0; 00035 rho=0; 00036 00037 int i,j; 00038 SetDim(density.dim); 00039 00040 for(i=0;i<dim;i++){ 00041 for(j=0;j<dim;j++){ 00042 rho[i][j]=density.rho[i][j]; 00043 } 00044 } 00045 }
EvtSpinDensity::~EvtSpinDensity | ( | ) | [virtual] |
Definition at line 61 of file EvtSpinDensity.cc.
References dim, genRecEmupikp::i, and rho.
00061 { 00062 if (dim!=0){ 00063 int i; 00064 for(i=0;i<dim;i++) delete [] rho[i]; 00065 } 00066 00067 delete [] rho; 00068 }
EvtSpinDensity::EvtSpinDensity | ( | ) |
int EvtSpinDensity::Check | ( | ) |
Definition at line 150 of file EvtSpinDensity.cc.
References abs, dim, calibUtil::ERROR, genRecEmupikp::i, imag(), Bes_Common::INFO, ganga-rec::j, report(), and rho.
Referenced by EvtDecayAmp::makeDecay().
00150 { 00151 00152 if (dim<1) { 00153 report(ERROR,"EvtGen")<<"dim="<<dim<<"in SpinDensity::Check"<<endl; 00154 } 00155 00156 int i,j; 00157 00158 for(i=0;i<dim;i++){ 00159 00160 if (real(rho[i][i])<0.0) return 0; 00161 if (imag(rho[i][i])*1000000.0>abs(rho[i][i])) { 00162 report(INFO,"EvtGen") << "Failing 1"<<endl; 00163 return 0; 00164 } 00165 } 00166 00167 for(i=0;i<dim;i++){ 00168 for(j=i+1;j<dim;j++){ 00169 if (fabs(real(rho[i][j]-rho[j][i]))> 00170 0.00000001*(abs(rho[i][i])+abs(rho[j][j]))) { 00171 report(INFO,"EvtGen") << "Failing 2"<<endl; 00172 return 0; 00173 } 00174 if (fabs(imag(rho[i][j]+rho[j][i]))> 00175 0.00000001*(abs(rho[i][i])+abs(rho[j][j]))) { 00176 report(INFO,"EvtGen") << "Failing 3"<<endl; 00177 return 0; 00178 } 00179 } 00180 } 00181 00182 return 1; 00183 }
const EvtComplex & EvtSpinDensity::Get | ( | int | i, | |
int | j | |||
) | const |
Definition at line 104 of file EvtSpinDensity.cc.
Referenced by EvtAmp::contract(), and EvtParticle::setSpinDensityForwardHelicityBasis().
int EvtSpinDensity::GetDim | ( | ) | const |
Definition at line 95 of file EvtSpinDensity.cc.
References dim.
Referenced by EvtParticle::setSpinDensityForwardHelicityBasis().
00095 { 00096 return dim; 00097 }
double EvtSpinDensity::NormalizedProb | ( | const EvtSpinDensity & | d | ) |
Definition at line 121 of file EvtSpinDensity.cc.
References dim, calibUtil::ERROR, genRecEmupikp::i, imag(), ganga-rec::j, report(), and rho.
Referenced by EvtbTosllAmp::CalcMaxProb(), EvtSemiLeptonicAmp::CalcMaxProb(), and EvtDecayAmp::makeDecay().
00121 { 00122 00123 int i,j; 00124 EvtComplex prob(0.0,0.0); 00125 double norm=0.0; 00126 00127 if (dim!=d.dim) { 00128 report(ERROR,"EvtGen")<<"Not matching dimensions in NormalizedProb"<<endl; 00129 ::abort(); 00130 } 00131 00132 for(i=0;i<dim;i++){ 00133 norm+=real(rho[i][i]); 00134 for(j=0;j<dim;j++){ 00135 prob+=rho[i][j]*d.rho[i][j]; 00136 } 00137 } 00138 00139 if (imag(prob)>0.00000001*real(prob)) { 00140 report(ERROR,"EvtGen")<<"Imaginary probability:"<<prob<<" "<<norm<<endl; 00141 } 00142 if (real(prob)<0.0) { 00143 report(ERROR,"EvtGen")<<"Negative probability:"<<prob<<" "<<norm<<endl; 00144 } 00145 00146 return real(prob)/norm; 00147 00148 }
EvtSpinDensity & EvtSpinDensity::operator= | ( | const EvtSpinDensity & | density | ) |
Definition at line 47 of file EvtSpinDensity.cc.
References dim, genRecEmupikp::i, ganga-rec::j, rho, and SetDim().
00047 { 00048 int i,j; 00049 SetDim(density.dim); 00050 00051 for(i=0;i<dim;i++){ 00052 for(j=0;j<dim;j++){ 00053 rho[i][j]=density.rho[i][j]; 00054 } 00055 } 00056 00057 return *this; 00058 00059 }
void EvtSpinDensity::Set | ( | int | i, | |
int | j, | |||
const EvtComplex & | rhoij | |||
) |
Definition at line 99 of file EvtSpinDensity.cc.
Referenced by EvtAmp::contract(), EvtVectorIsr::decay(), EvtTauola::fixPolarizations(), EvtPythia::fixPolarizations(), EvtOpenCharm::fixPolarizations(), EvtLundCharm::fixPolarizations(), EvtLunda::fixPolarizations(), EvtJetSet::fixPolarizations(), EvtAmp::getBackwardSpinDensity(), EvtAmp::getForwardSpinDensity(), EvtAmp::getSpinDensity(), EvtDecayAmp::makeDecay(), EvtParticle::setPolarizedSpinDensity(), EvtParticle::setSpinDensityForwardHelicityBasis(), and EvtParticle::setVectorSpinDensity().
void EvtSpinDensity::SetDiag | ( | int | n | ) |
Definition at line 109 of file EvtSpinDensity.cc.
References genRecEmupikp::i, ganga-rec::j, rho, and SetDim().
Referenced by EvtbTosllAmp::CalcMaxProb(), EvtSemiLeptonicAmp::CalcMaxProb(), EvtParticle::decay(), EvtDecayProb::makeDecay(), EvtDecayIncoherent::makeDecay(), EvtParticleFactory::particleFactory(), EvtParticle::setDiagonalSpinDensity(), EvtParticle::setPolarizedSpinDensity(), and EvtParticle::setVectorSpinDensity().
00109 { 00110 SetDim(n); 00111 int i,j; 00112 00113 for(i=0;i<n;i++){ 00114 for(j=0;j<n;j++){ 00115 rho[i][j]=EvtComplex(0.0); 00116 } 00117 rho[i][i]=EvtComplex(1.0); 00118 } 00119 }
void EvtSpinDensity::SetDim | ( | int | n | ) |
Definition at line 75 of file EvtSpinDensity.cc.
References dim, genRecEmupikp::i, and rho.
Referenced by EvtAmp::contract(), EvtVectorIsr::decay(), EvtSpinDensity(), EvtOpenCharm::fixPolarizations(), EvtAmp::getBackwardSpinDensity(), EvtAmp::getForwardSpinDensity(), EvtAmp::getSpinDensity(), EvtDecayAmp::makeDecay(), operator=(), SetDiag(), and EvtParticle::setSpinDensityForwardHelicityBasis().
00075 { 00076 if (dim==n) return; 00077 if (dim!=0){ 00078 int i; 00079 for(i=0;i<dim;i++) delete [] rho[i]; 00080 delete [] rho; 00081 rho=0; 00082 dim=0; 00083 } 00084 if (n==0) return; 00085 dim=n; 00086 rho=new EvtComplexPtr[n]; 00087 int i; 00088 for(i=0;i<n;i++){ 00089 rho[i]=new EvtComplex[n]; 00090 } 00091 00092 00093 }
std::ostream& operator<< | ( | std::ostream & | s, | |
const EvtSpinDensity & | d | |||
) | [friend] |
int EvtSpinDensity::dim [private] |
Definition at line 49 of file EvtSpinDensity.hh.
Referenced by Check(), EvtSpinDensity(), Get(), GetDim(), NormalizedProb(), operator<<(), operator=(), Set(), SetDim(), and ~EvtSpinDensity().
EvtComplexPtrPtr EvtSpinDensity::rho [private] |
Definition at line 48 of file EvtSpinDensity.hh.
Referenced by Check(), EvtSpinDensity(), Get(), NormalizedProb(), operator<<(), operator=(), Set(), SetDiag(), SetDim(), and ~EvtSpinDensity().