BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtSingleParticle2.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtSingleParticle.cc
12//
13// Description: Special model to generate single particles.
14//
15// Modification history:
16//
17// RYD Febuary 17,1998 Module created
18//
19//------------------------------------------------------------------------
20//
21#include "EvtSingleParticle2.hh"
28#include <stdlib.h>
29#include <string>
30using std::endl;
31
33
34void EvtSingleParticle2::getName( std::string& model_name ) { model_name = "SINGLE2"; }
35
37
39
40 // turn off checks for charge conservation
42
43 if ( ( getNArg() == 6 ) || ( getNArg() == 4 ) || ( getNArg() == 2 ) )
44 {
45
46 if ( getNArg() == 6 )
47 {
48 // copy the arguments into eaiser to remember names!
49
50 pxymin = getArg( 0 );
51 pxymax = getArg( 1 );
52
53 thetamin = getArg( 2 );
54 thetamax = getArg( 3 );
55
56 phimin = getArg( 4 );
57 phimax = getArg( 5 );
58 }
59
60 if ( getNArg() == 4 )
61 {
62 // copy the arguments into eaiser to remember names!
63 pxymin = getArg( 0 );
64 pxymax = getArg( 1 );
65
66 thetamin = getArg( 2 );
67 thetamax = getArg( 3 );
68
69 phimin = 0.0;
70 phimax = EvtConst::twoPi;
71 }
72
73 if ( getNArg() == 2 )
74 {
75 // copy the arguments into eaiser to remember names!
76 pxymin = getArg( 0 );
77 pxymax = getArg( 1 );
78
79 thetamin = 0.376383;
80 thetamax = 2.76521; //|cos(theta)|<0.93
81
82 phimin = 0.0;
83 phimax = EvtConst::twoPi;
84 }
85 }
86 else
87 {
88
89 report( ERROR, "EvtGen" ) << "EvtSingleParticle generator expected "
90 << " 5, 3, or 1 arguments but found:" << getNArg() << endl;
91 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
92 ::abort();
93 }
94
95 report( INFO, "EvtGen" ) << "The single particle generator has been configured:" << endl;
96 report( INFO, "EvtGen" ) << thetamax << " > theta > " << thetamin << endl;
97 report( INFO, "EvtGen" ) << phimax << " > phi > " << phimin << endl;
98}
99
101
102 EvtParticle* d;
103 EvtVector4R p4;
104
105 double mass = EvtPDL::getMass( getDaug( 0 ) );
106
108 d = p->getDaug( 0 );
109
110 // generate flat distribution in p
111 // we are now in the parents restframe! This means the
112 // restframe of the e+e- collison.
113
114 double theta;
115 if ( thetamax == thetamin ) { theta = thetamax; }
116 else theta = EvtRandom::Flat( thetamin, thetamax );
117 double phi;
118 if ( phimin == phimax ) { phi = phimin; }
119 else phi = EvtRandom::Flat( phimin, phimax );
120 double pxy;
121 if ( pxymin == pxymax ) { pxy = pxymin; }
122 else pxy = EvtRandom::Flat( pxymin, pxymax );
123
124 pmag = pxy / sin( theta );
125 cthetamax = cos( thetamax );
126 cthetamin = cos( thetamin );
127 double cthetalab;
128
129 // do{
130 // generate flat distribution in costheta
131
132 p4.set( sqrt( mass * mass + pmag * pmag ), pmag * cos( phi ) * sin( theta ),
133 pmag * sin( phi ) * sin( theta ), pmag * cos( theta ) );
134 d->init( getDaug( 0 ), p4 );
135 // get 4 vector in the lab frame!
136 EvtVector4R p4lab = d->getP4Lab();
137 cthetalab = p4lab.get( 3 ) / p4lab.d3mag();
138 // }while (cthetalab>cthetamax||cthetalab<cthetamin);
139
140 return;
141}
double mass
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
@ INFO
Definition EvtReport.hh:52
static const double twoPi
Definition EvtConst.hh:28
double getArg(int j)
void disableCheckQ()
EvtId * getDaugs()
EvtId getDaug(int i)
static double getMass(EvtId i)
Definition EvtPDL.hh:44
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtVector4R getP4Lab()
EvtParticle * getDaug(int i)
static double Flat()
Definition EvtRandom.cc:69
void getName(std::string &name)
void decay(EvtParticle *p)
EvtDecayBase * clone()
double get(int i) const
double d3mag() const
void set(int i, double d)