BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAngSam3.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: EvtAngSam3.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 "EvtAngSam3.hh"
43#include <stdlib.h>
44#include <string>
45using std::cout;
46using std::endl;
47
49
50void EvtAngSam3::getName( std::string& model_name ) { model_name = "AngSam3"; }
51
53
55
56 // check angular distribution parameters
57 checkNDaug( 3 );
59
60 if ( getNArg() > 6 || getNArg() < 2 )
61 {
62 report( ERROR, "EvtGen" ) << " 2<= expected parameters <=6, but it is " << getNArg()
63 << endl;
64 ::abort();
65 }
66}
67
69
71
72loop:
74
75 EvtParticle *v, *s1, *s2;
76 EvtVector4R pv, ps;
77 EvtVector4R Lpt, xp;
78
79 v = p->getDaug( 0 );
80 s1 = p->getDaug( 1 );
81 s2 = p->getDaug( 2 );
82 pv = v->getP4();
83 ps = s1->getP4();
84 Lpt = p->getP4();
85 xp = pv.cross( ps );
86
87 // calculate the cos (theta) between xp and Lpt
88 double costheta;
89 if ( Lpt.d3mag() < 0.0001 ) { costheta = xp.get( 3 ) / xp.d3mag(); }
90 else
91 {
92 costheta = ( xp.get( 1 ) * Lpt.get( 1 ) + xp.get( 2 ) * Lpt.get( 2 ) +
93 xp.get( 3 ) * Lpt.get( 3 ) ) /
94 xp.d3mag() / Lpt.d3mag();
95 }
96 int narg = getNArg();
97 double c0, c2, c4, c6, c8, c10;
98 c0 = 0;
99 c2 = 0;
100 c4 = 0;
101 c6 = 0;
102 c8 = 0;
103 c10 = 0;
104 if ( narg == 2 )
105 {
106 c0 = getArg( 0 );
107 c2 = getArg( 1 );
108 }
109 else if ( narg == 3 )
110 {
111 c0 = getArg( 0 );
112 c2 = getArg( 1 );
113 c4 = getArg( 2 );
114 }
115 else if ( narg == 4 )
116 {
117 c0 = getArg( 0 );
118 c2 = getArg( 1 );
119 c4 = getArg( 2 );
120 c6 = getArg( 3 );
121 }
122 else if ( narg == 5 )
123 {
124 c0 = getArg( 0 );
125 c2 = getArg( 1 );
126 c4 = getArg( 2 );
127 c6 = getArg( 3 );
128 c8 = getArg( 4 );
129 }
130 else if ( narg == 6 )
131 {
132 c0 = getArg( 0 );
133 c2 = getArg( 1 );
134 c4 = getArg( 2 );
135 c6 = getArg( 3 );
136 c8 = getArg( 4 );
137 c10 = getArg( 5 );
138 }
139
140 double costheta2 = costheta * costheta;
141 double costheta4 = costheta2 * costheta2;
142 double costheta6 = costheta4 * costheta2;
143 double costheta8 = costheta6 * costheta2;
144 double costheta10 = costheta8 * costheta2;
145
146 double amp1 = ( c0 + c2 * costheta2 + c4 * costheta4 + c6 * costheta6 + c8 * costheta8 +
147 c10 * costheta10 );
148 double a0, a2, a4, a6, a8, a10;
149 double ampflag;
150 if ( c0 < 0 ) { a0 = 0; }
151 else { a0 = c0; }
152 if ( c2 < 0 ) { a2 = 0; }
153 else { a2 = c2; }
154 if ( c4 < 0 ) { a4 = 0; }
155 else { a4 = c4; }
156 if ( c6 < 0 ) { a6 = 0; }
157 else { a6 = c6; }
158 if ( c8 < 0 ) { a8 = 0; }
159 else { a8 = c8; }
160 if ( c10 < 0 ) { a10 = 0; }
161 else { a10 = c10; }
162 ampflag = a0 + a2 + a4 + a6 + a8 + a10;
163 if ( ampflag <= 0 )
164 {
165 report( ERROR, "EvtGen" )
166 << " The maxium value of amplitude square should be positive, but it is " << ampflag
167 << endl;
168 ::abort();
169 }
170 ampflag = amp1 / ampflag;
171 double rd1 = EvtRandom::Flat( 0.0, 1.0 );
172 if ( rd1 >= ampflag ) goto loop;
173 return;
174}
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
virtual ~EvtAngSam3()
Definition EvtAngSam3.cc:48
EvtDecayBase * clone()
Definition EvtAngSam3.cc:52
void getName(std::string &name)
Definition EvtAngSam3.cc:50
void init()
Definition EvtAngSam3.cc:54
void initProbMax()
Definition EvtAngSam3.cc:68
void decay(EvtParticle *p)
Definition EvtAngSam3.cc:70
double getArg(int j)
EvtId getParentId()
void checkNDaug(int d1, int d2=-1)
EvtId * getDaugs()
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
double get(int i) const
EvtVector4R cross(const EvtVector4R &v2)
double d3mag() const