BOSS 7.0.6
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 Lab
14// system.
15//
16// Modification history:
17//
18// Ping R.-G. December, 2006 Module created
19//
20//------------------------------------------------------------------------
21//
23#include <stdlib.h>
26#include "EvtGenBase/EvtPDL.hh"
43#include <string>
44using std::endl;
45
47
48void EvtAngSam::getName(std::string& model_name){
49
50 model_name="AngSam";
51
52}
53
55
56 return new EvtAngSam;
57
58}
59
60
62
63 // check that there are 1 arguments:angular distribution parameter
64 checkNDaug(2);
66// if ( parenttype == EvtSpinType::SCALAR ){
67// report(ERROR,"EvtGen")<<"Scalar decays with flat distribution"<<endl;
68// ::abort();
69// }
70 if(getNArg()>6 || getNArg()<2 ) {
71 report(ERROR,"EvtGen")<<" 2<= expected parameters <=6, but it is "<< getNArg()<<endl;
72 ::abort();
73 }
74}
76
77 noProbMax();
78
79}
80
82
83loop:
85
86 EvtParticle *v,*s1;
87 EvtVector4R pv,ps,ppr;
88
89 v =p->getDaug(0); //gamma
90 s1=p->getDaug(1); //J/psi
91 pv=v->getP4();
92 ps=s1->getP4();
93 ppr=p->getP4();
94// Put phase space results into the daughters.
95 EvtHelSys angles(ppr,pv); //using helicity sys. angles
96 double theta =angles.getHelAng(1);
97
98// The angular form is: c0 + c2*cos^2(theta) + c4*cos^4(theta) + c6*cos^6(theta) + c8*cos^8(theta) + c10*cos^10(theta)
99// The parameters c0-c10 are specified by user in the decay list
100 int narg=getNArg();
101 double c0,c2,c4,c6,c8,c10;
102 c0=0;c2=0;c4=0;c6=0;c8=0;c10=0;
103 if(narg==2) {
104 c0=getArg(0);
105 c2=getArg(1);
106 } else if (narg==3){
107 c0=getArg(0);
108 c2=getArg(1);
109 c4=getArg(2);
110 } else if (narg==4){
111 c0=getArg(0);
112 c2=getArg(1);
113 c4=getArg(2);
114 c6=getArg(3);
115 } else if (narg==5){
116 c0=getArg(0);
117 c2=getArg(1);
118 c4=getArg(2);
119 c6=getArg(3);
120 c8=getArg(4);
121 } else if (narg==6){
122 c0=getArg(0);
123 c2=getArg(1);
124 c4=getArg(2);
125 c6=getArg(3);
126 c8=getArg(4);
127 c10=getArg(5);
128 }
129
130 double costheta= cos(theta);
131 double costheta2= costheta*costheta;
132 double costheta4= costheta2*costheta2;
133 double costheta6= costheta4*costheta2;
134 double costheta8= costheta6*costheta2;
135 double costheta10= costheta8*costheta2;
136
137 double amp1=(c0+c2*costheta2+c4*costheta4+c6*costheta6+c8*costheta8+c10*costheta10);
138 double a0,a2,a4,a6,a8,a10;
139 double ampflag;
140 if(c0<0) {a0=0;}else{a0=c0;}
141 if(c2<0) {a2=0;}else{a2=c2;}
142 if(c4<0) {a4=0;}else{a4=c4;}
143 if(c6<0) {a6=0;}else{a6=c6;}
144 if(c8<0) {a8=0;}else{a8=c8;}
145 if(c10<0) {a10=0;}else{a10=c10;}
146 ampflag=a0+a2+a4+a6+a8+a10;
147 if( ampflag<=0 ) {
148 report(ERROR,"EvtGen")<<" The maxium value of amplitude square should be positive, but it is "<< ampflag<<endl;
149 ::abort();
150 }
151 ampflag = amp1/ampflag;
152 double rd1=EvtRandom::Flat(0.0, 1.0);
153 if(rd1>=ampflag) goto loop;
154 return ;
155}
156
157
double cos(const BesAngle a)
Definition: BesAngle.h:213
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ 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:75
void init()
Definition: EvtAngSam.cc:61
virtual ~EvtAngSam()
Definition: EvtAngSam.cc:46
void getName(std::string &name)
Definition: EvtAngSam.cc:48
EvtDecayBase * clone()
Definition: EvtAngSam.cc:54
void decay(EvtParticle *p)
Definition: EvtAngSam.cc:81
double getArg(int j)
void noProbMax()
EvtId getParentId()
Definition: EvtDecayBase.hh:60
void checkNDaug(int d1, int d2=-1)
EvtId * getDaugs()
Definition: EvtDecayBase.hh:65
double getHelAng(int i)
Definition: EvtHelSys.cc:54
static EvtSpinType::spintype getSpinType(EvtId i)
Definition: EvtPDL.hh:61
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static double Flat()
Definition: EvtRandom.cc:74
float costheta