BOSS 7.0.2
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 ()
 

Friends

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

Detailed Description

Definition at line 27 of file EvtSpinDensity.hh.

Constructor & Destructor Documentation

◆ EvtSpinDensity() [1/2]

EvtSpinDensity::EvtSpinDensity ( const EvtSpinDensity density)

Definition at line 33 of file 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}
void SetDim(int n)

◆ ~EvtSpinDensity()

EvtSpinDensity::~EvtSpinDensity ( )
virtual

Definition at line 61 of file 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/2]

EvtSpinDensity::EvtSpinDensity ( )

Definition at line 70 of file EvtSpinDensity.cc.

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

Member Function Documentation

◆ Check()

int EvtSpinDensity::Check ( )

Definition at line 150 of file 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)
Definition: EvtComplex.hh:246
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49
@ INFO
Definition: EvtReport.hh:52

Referenced by EvtDecayAmp::makeDecay().

◆ Get()

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

Definition at line 104 of file EvtSpinDensity.cc.

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

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

◆ GetDim()

int EvtSpinDensity::GetDim ( ) const

Definition at line 95 of file EvtSpinDensity.cc.

95 {
96 return dim;
97}

Referenced by EvtParticle::setSpinDensityForwardHelicityBasis().

◆ NormalizedProb()

double EvtSpinDensity::NormalizedProb ( const EvtSpinDensity d)

Definition at line 121 of file 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().

◆ operator=()

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

Definition at line 47 of file 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}

◆ Set()

◆ SetDiag()

void EvtSpinDensity::SetDiag ( int  n)

◆ SetDim()

void EvtSpinDensity::SetDim ( int  n)

Definition at line 75 of file 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().

Friends And Related Function Documentation

◆ operator<<

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

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