BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAngSam.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of models developed at BES collaboration
5// based on the EvtGen framework. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/BesCopyright
9// Copyright (A) 2006 Ping Rong-Gang @IHEP
10//
11// Module: EvtAngSam.cc
12//
13// Description: Routine to decay a particle to two bodies by sampling angular distribution in
14// Lab
15// system.
16//
17// Modification history:
18//
19// Ping R.-G. December, 2006 Module created
20//
21//------------------------------------------------------------------------
22//
23#include "EvtAngSam.hh"
43#include <stdlib.h>
44#include <string>
45using std::endl;
46
48
49void EvtAngSam::getName( std::string& model_name ) { model_name = "AngSam"; }
50
52
54
55 // check that there are 1 arguments:angular distribution parameter
56 checkNDaug( 2 );
58 // if ( parenttype == EvtSpinType::SCALAR ){
59 // report(ERROR,"EvtGen")<<"Scalar decays with flat distribution"<<endl;
60 // ::abort();
61 // }
62 if ( getNArg() > 6 || getNArg() < 2 )
63 {
64 report( ERROR, "EvtGen" ) << " 2<= expected parameters <=6, but it is " << getNArg()
65 << endl;
66 ::abort();
67 }
68}
70
72
73loop:
75
76 EvtParticle *v, *s1;
77 EvtVector4R pv, ps, ppr;
78
79 v = p->getDaug( 0 ); // gamma
80 s1 = p->getDaug( 1 ); // J/psi
81 pv = v->getP4();
82 ps = s1->getP4();
83 ppr = p->getP4();
84 // Put phase space results into the daughters.
85 EvtHelSys angles( ppr, pv ); // using helicity sys. angles
86 double theta = angles.getHelAng( 1 );
87
88 // The angular form is: c0 + c2*cos^2(theta) + c4*cos^4(theta) + c6*cos^6(theta) +
89 // c8*cos^8(theta) + c10*cos^10(theta) The parameters c0-c10 are specified by user in the
90 // decay list
91 int narg = getNArg();
92 double c0, c2, c4, c6, c8, c10;
93 c0 = 0;
94 c2 = 0;
95 c4 = 0;
96 c6 = 0;
97 c8 = 0;
98 c10 = 0;
99 if ( narg == 2 )
100 {
101 c0 = getArg( 0 );
102 c2 = getArg( 1 );
103 }
104 else if ( narg == 3 )
105 {
106 c0 = getArg( 0 );
107 c2 = getArg( 1 );
108 c4 = getArg( 2 );
109 }
110 else if ( narg == 4 )
111 {
112 c0 = getArg( 0 );
113 c2 = getArg( 1 );
114 c4 = getArg( 2 );
115 c6 = getArg( 3 );
116 }
117 else if ( narg == 5 )
118 {
119 c0 = getArg( 0 );
120 c2 = getArg( 1 );
121 c4 = getArg( 2 );
122 c6 = getArg( 3 );
123 c8 = getArg( 4 );
124 }
125 else if ( narg == 6 )
126 {
127 c0 = getArg( 0 );
128 c2 = getArg( 1 );
129 c4 = getArg( 2 );
130 c6 = getArg( 3 );
131 c8 = getArg( 4 );
132 c10 = getArg( 5 );
133 }
134
135 double costheta = cos( theta );
136 double costheta2 = costheta * costheta;
137 double costheta4 = costheta2 * costheta2;
138 double costheta6 = costheta4 * costheta2;
139 double costheta8 = costheta6 * costheta2;
140 double costheta10 = costheta8 * costheta2;
141
142 double amp1 = ( c0 + c2 * costheta2 + c4 * costheta4 + c6 * costheta6 + c8 * costheta8 +
143 c10 * costheta10 );
144 double a0, a2, a4, a6, a8, a10;
145 double ampflag;
146 if ( c0 < 0 ) { a0 = 0; }
147 else { a0 = c0; }
148 if ( c2 < 0 ) { a2 = 0; }
149 else { a2 = c2; }
150 if ( c4 < 0 ) { a4 = 0; }
151 else { a4 = c4; }
152 if ( c6 < 0 ) { a6 = 0; }
153 else { a6 = c6; }
154 if ( c8 < 0 ) { a8 = 0; }
155 else { a8 = c8; }
156 if ( c10 < 0 ) { a10 = 0; }
157 else { a10 = c10; }
158 ampflag = a0 + a2 + a4 + a6 + a8 + a10;
159 if ( ampflag <= 0 )
160 {
161 report( ERROR, "EvtGen" )
162 << " The maxium value of amplitude square should be positive, but it is " << ampflag
163 << endl;
164 ::abort();
165 }
166 ampflag = amp1 / ampflag;
167 double rd1 = EvtRandom::Flat( 0.0, 1.0 );
168 if ( rd1 >= ampflag ) goto loop;
169 return;
170}
character *LEPTONflag integer iresonances real zeta5 real a0
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
void initProbMax()
Definition EvtAngSam.cc:69
void init()
Definition EvtAngSam.cc:53
virtual ~EvtAngSam()
Definition EvtAngSam.cc:47
void getName(std::string &name)
Definition EvtAngSam.cc:49
EvtDecayBase * clone()
Definition EvtAngSam.cc:51
void decay(EvtParticle *p)
Definition EvtAngSam.cc:71
double getArg(int j)
EvtId getParentId()
void checkNDaug(int d1, int d2=-1)
EvtId * getDaugs()
double getHelAng(int i)
Definition EvtHelSys.cc:52
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.hh:66
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static double Flat()
Definition EvtRandom.cc:69