BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtSpinDensity Class Reference

#include <EvtSpinDensity.hh>

Public Member Functions

 EvtSpinDensity (const EvtSpinDensity &density)
 
EvtSpinDensityoperator= (const EvtSpinDensity &density)
 
virtual ~EvtSpinDensity ()
 
 EvtSpinDensity ()
 
void SetDim (int n)
 
int GetDim () const
 
void Set (int i, int j, const EvtComplex &rhoij)
 
const EvtComplexGet (int i, int j) const
 
double NormalizedProb (const EvtSpinDensity &d)
 
void SetDiag (int n)
 
int Check ()
 
 EvtSpinDensity (const EvtSpinDensity &density)
 
EvtSpinDensityoperator= (const EvtSpinDensity &density)
 
virtual ~EvtSpinDensity ()
 
 EvtSpinDensity ()
 
void SetDim (int n)
 
int GetDim () const
 
void Set (int i, int j, const EvtComplex &rhoij)
 
const EvtComplexGet (int i, int j) const
 
double NormalizedProb (const EvtSpinDensity &d)
 
void SetDiag (int n)
 
int Check ()
 

Friends

std::ostream & operator<< (std::ostream &s, const EvtSpinDensity &d)
 
std::ostream & operator<< (std::ostream &s, const EvtSpinDensity &d)
 

Detailed Description

Constructor & Destructor Documentation

◆ EvtSpinDensity() [1/4]

EvtSpinDensity::EvtSpinDensity ( const EvtSpinDensity density)

Definition at line 33 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

33 {
34 dim=0;
35 rho=0;
36
37 int i,j;
38 SetDim(density.dim);
39
40 for(i=0;i<dim;i++){
41 for(j=0;j<dim;j++){
42 rho[i][j]=density.rho[i][j];
43 }
44 }
45}

◆ ~EvtSpinDensity() [1/2]

EvtSpinDensity::~EvtSpinDensity ( )
virtual

Definition at line 61 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

61 {
62 if (dim!=0){
63 int i;
64 for(i=0;i<dim;i++) delete [] rho[i];
65 }
66
67 delete [] rho;
68}

◆ EvtSpinDensity() [2/4]

EvtSpinDensity::EvtSpinDensity ( )

Definition at line 70 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

70 {
71 dim=0;
72 rho=0;
73}

◆ EvtSpinDensity() [3/4]

EvtSpinDensity::EvtSpinDensity ( const EvtSpinDensity density)

◆ ~EvtSpinDensity() [2/2]

virtual EvtSpinDensity::~EvtSpinDensity ( )
virtual

◆ EvtSpinDensity() [4/4]

EvtSpinDensity::EvtSpinDensity ( )

Member Function Documentation

◆ Check() [1/2]

int EvtSpinDensity::Check ( )

Definition at line 150 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

150 {
151
152 if (dim<1) {
153 report(ERROR,"EvtGen")<<"dim="<<dim<<"in SpinDensity::Check"<<endl;
154 }
155
156 int i,j;
157
158 for(i=0;i<dim;i++){
159
160 if (real(rho[i][i])<0.0) return 0;
161 if (imag(rho[i][i])*1000000.0>abs(rho[i][i])) {
162 report(INFO,"EvtGen") << "Failing 1"<<endl;
163 return 0;
164 }
165 }
166
167 for(i=0;i<dim;i++){
168 for(j=i+1;j<dim;j++){
169 if (fabs(real(rho[i][j]-rho[j][i]))>
170 0.00000001*(abs(rho[i][i])+abs(rho[j][j]))) {
171 report(INFO,"EvtGen") << "Failing 2"<<endl;
172 return 0;
173 }
174 if (fabs(imag(rho[i][j]+rho[j][i]))>
175 0.00000001*(abs(rho[i][i])+abs(rho[j][j]))) {
176 report(INFO,"EvtGen") << "Failing 3"<<endl;
177 return 0;
178 }
179 }
180 }
181
182 return 1;
183}
double imag(const EvtComplex &c)
ostream & report(Severity severity, const char *facility)

Referenced by EvtDecayAmp::makeDecay().

◆ Check() [2/2]

int EvtSpinDensity::Check ( )

◆ Get() [1/2]

const EvtComplex & EvtSpinDensity::Get ( int  i,
int  j 
) const

Definition at line 104 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

104 {
105 assert(i<dim&&j<dim);
106 return rho[i][j];
107}

Referenced by EvtAmp::contract(), and EvtParticle::setSpinDensityForwardHelicityBasis().

◆ Get() [2/2]

const EvtComplex & EvtSpinDensity::Get ( int  i,
int  j 
) const

◆ GetDim() [1/2]

int EvtSpinDensity::GetDim ( ) const

◆ GetDim() [2/2]

int EvtSpinDensity::GetDim ( ) const

◆ NormalizedProb() [1/2]

double EvtSpinDensity::NormalizedProb ( const EvtSpinDensity d)

Definition at line 121 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

121 {
122
123 int i,j;
124 EvtComplex prob(0.0,0.0);
125 double norm=0.0;
126
127 if (dim!=d.dim) {
128 report(ERROR,"EvtGen")<<"Not matching dimensions in NormalizedProb"<<endl;
129 ::abort();
130 }
131
132 for(i=0;i<dim;i++){
133 norm+=real(rho[i][i]);
134 for(j=0;j<dim;j++){
135 prob+=rho[i][j]*d.rho[i][j];
136 }
137 }
138
139 if (imag(prob)>0.00000001*real(prob)) {
140 report(ERROR,"EvtGen")<<"Imaginary probability:"<<prob<<" "<<norm<<endl;
141 }
142 if (real(prob)<0.0) {
143 report(ERROR,"EvtGen")<<"Negative probability:"<<prob<<" "<<norm<<endl;
144 }
145
146 return real(prob)/norm;
147
148}

Referenced by EvtbTosllAmp::CalcMaxProb(), EvtSemiLeptonicAmp::CalcMaxProb(), and EvtDecayAmp::makeDecay().

◆ NormalizedProb() [2/2]

double EvtSpinDensity::NormalizedProb ( const EvtSpinDensity d)

◆ operator=() [1/2]

EvtSpinDensity & EvtSpinDensity::operator= ( const EvtSpinDensity density)

Definition at line 47 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

47 {
48 int i,j;
49 SetDim(density.dim);
50
51 for(i=0;i<dim;i++){
52 for(j=0;j<dim;j++){
53 rho[i][j]=density.rho[i][j];
54 }
55 }
56
57 return *this;
58
59}

◆ operator=() [2/2]

EvtSpinDensity & EvtSpinDensity::operator= ( const EvtSpinDensity density)

◆ Set() [1/2]

◆ Set() [2/2]

void EvtSpinDensity::Set ( int  i,
int  j,
const EvtComplex rhoij 
)

◆ SetDiag() [1/2]

◆ SetDiag() [2/2]

void EvtSpinDensity::SetDiag ( int  n)

◆ SetDim() [1/2]

void EvtSpinDensity::SetDim ( int  n)

Definition at line 75 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtSpinDensity.cc.

75 {
76 if (dim==n) return;
77 if (dim!=0){
78 int i;
79 for(i=0;i<dim;i++) delete [] rho[i];
80 delete [] rho;
81 rho=0;
82 dim=0;
83 }
84 if (n==0) return;
85 dim=n;
86 rho=new EvtComplexPtr[n];
87 int i;
88 for(i=0;i<n;i++){
89 rho[i]=new EvtComplex[n];
90 }
91
92
93}

Referenced by EvtAmp::contract(), EvtVectorIsr::decay(), EvtSpinDensity(), EvtAmp::getBackwardSpinDensity(), EvtAmp::getForwardSpinDensity(), EvtAmp::getSpinDensity(), EvtDecayAmp::makeDecay(), operator=(), SetDiag(), and EvtParticle::setSpinDensityForwardHelicityBasis().

◆ SetDim() [2/2]

void EvtSpinDensity::SetDim ( int  n)

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  s,
const EvtSpinDensity d 
)
friend

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  s,
const EvtSpinDensity d 
)
friend

The documentation for this class was generated from the following files: