BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPHOTOS.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: EvtPHOTOS.cc
12//
13// Description: This routine takes the particle *p and applies
14// the PHOTOS package to generate final state radiation
15// on the produced mesons.
16//
17// Modification history:
18//
19// RYD October 1, 1997 Module created
20//
21//------------------------------------------------------------------------
22//
23#include "EvtPHOTOS.hh"
29
30extern "C" void begevtgenstorex_( int*, int*, int*, int*, int*, int*, int*, int*, double*,
31 double*, double*, double*, double*, double*, double*,
32 double*, double* );
33
34extern "C" void begevtgengetx_( int*, int*, int*, int*, int*, int*, int*, int*, double*,
35 double*, double*, double*, double*, double*, double*, double*,
36 double* );
37
38extern "C" void heplst_( int* );
39
40extern "C" void photos_( int* );
41
42extern "C" void phoini_();
43
45
46 static int first = 1;
47
48 // added by Lange Jan4,2000
49 static EvtId GAMM = EvtPDL::getId( "gammaFSR" ); // pingrg, 2009/02/19
50
51 if ( first )
52 {
53
54 first = 0;
55 phoini_();
56 }
57
58 int entry, eventnum, numparticle, istat, partnum, mother;
59 int daugfirst, dauglast;
60
61 int numparticlephotos;
62
63 double px, py, pz, e, m, x, y, z, t;
64
65 static EvtId dq = EvtPDL::getId( "d" );
66 static EvtId adq = EvtPDL::getId( "anti-d" );
67 static EvtId uq = EvtPDL::getId( "u" );
68 static EvtId auq = EvtPDL::getId( "anti-u" );
69 static EvtId sq = EvtPDL::getId( "s" );
70 static EvtId asq = EvtPDL::getId( "anti-s" );
71 static EvtId cq = EvtPDL::getId( "c" );
72 static EvtId acq = EvtPDL::getId( "anti-c" );
73 static EvtId bq = EvtPDL::getId( "b" );
74 static EvtId abq = EvtPDL::getId( "anti-b" );
75 static EvtId tq = EvtPDL::getId( "t" );
76 static EvtId atq = EvtPDL::getId( "anti-t" );
77 static EvtIdSet quarks( dq, adq, uq, auq, sq, asq, cq, acq, bq, abq, tq, atq );
78
79 px = 0.0;
80 py = 0.0;
81 pz = 0.0;
82 e = p->mass();
83 m = p->mass();
84 x = 0.0;
85 y = 0.0;
86 z = 0.0;
87 t = 0.0;
88
89 entry = 1;
90 eventnum = 1;
91 numparticle = 1;
92 istat = 2;
93 partnum = EvtPDL::getStdHep( p->getId() );
94 mother = 0;
95 daugfirst = 2;
96 dauglast = 1 + p->getNDaug();
97
98 begevtgenstorex_( &entry, &eventnum, &numparticle, &istat, &partnum, &mother, &daugfirst,
99 &dauglast, &px, &py, &pz, &e, &m, &x, &y, &z, &t );
100
101 int i;
102 // std::cout << EvtPDL::name(p->getId()) <<" " ;
103 for ( i = 0; i < p->getNDaug(); i++ )
104 {
105
106 // No quarks to photos
107 if ( quarks.contains( p->getDaug( i )->getId() ) == 1 ) continue;
108
109 px = p->getDaug( i )->getP4().get( 1 );
110 py = p->getDaug( i )->getP4().get( 2 );
111 pz = p->getDaug( i )->getP4().get( 3 );
112 e = p->getDaug( i )->getP4().get( 0 );
113 m = p->getDaug( i )->mass();
114 x = 0.0;
115 y = 0.0;
116 z = 0.0;
117 t = 0.0;
118
119 // std::cout << EvtPDL::name(p->getDaug(i)->getId()) << " " ;
120 entry += 1;
121 eventnum = 1;
122 numparticle += 1;
123 istat = 1;
124 partnum = EvtPDL::getStdHep( p->getDaug( i )->getId() );
125 mother = 1;
126 daugfirst = 0;
127 dauglast = 0;
128
129 begevtgenstorex_( &entry, &eventnum, &numparticle, &istat, &partnum, &mother, &daugfirst,
130 &dauglast, &px, &py, &pz, &e, &m, &x, &y, &z, &t );
131 }
132 // std::cout << std::endl;
133 // can't use heplst since the common block used by the BaBar
134 // implementation of PHOTOS is renamed due to real*4 vs real*8
135 // problems.
136
137 // int mlst=1;
138
139 // heplst_(&mlst);
140
141 entry = 1;
142
143 // report(INFO,"EvtGen") << "Doing photos " << EvtPDL::name(p->getId()) << endl;
144 photos_( &entry );
145 // report(INFO,"EvtGen") << "done\n";
146 begevtgengetx_( &entry, &eventnum, &numparticlephotos, &istat, &partnum, &mother, &daugfirst,
147 &dauglast, &px, &py, &pz, &e, &m, &x, &y, &z, &t );
148
149 // report(INFO,"EvtGen") << "numparticlephotos:"<<numparticlephotos<<endl;
150
151 if ( numparticle == numparticlephotos ) return;
152
153 EvtVector4R new4mom;
154
155 int np;
156
157 for ( i = 0; i < p->getNDaug(); i++ )
158 {
159
160 entry = i + 2;
161
162 begevtgengetx_( &entry, &eventnum, &np, &istat, &partnum, &mother, &daugfirst, &dauglast,
163 &px, &py, &pz, &e, &m, &x, &y, &z, &t );
164
165 // this is needed to ensure that photos does not
166 // change the masses. But it will violate energy conservation!
167 double mp = p->getDaug( i )->mass();
168 e = sqrt( mp * mp + px * px + py * py + pz * pz );
169
170 new4mom.set( e, px, py, pz );
171
172 p->getDaug( i )->setP4( new4mom );
173 }
174
175 for ( entry = numparticle + 1; entry <= numparticlephotos; entry++ )
176 {
177
178 begevtgengetx_( &entry, &eventnum, &np, &istat, &partnum, &mother, &daugfirst, &dauglast,
179 &px, &py, &pz, &e, &m, &x, &y, &z, &t );
180
181 new4mom.set( e, px, py, pz );
182
183 // new4mom.dump();
184
185 EvtPhotonParticle* gamma;
186 gamma = new EvtPhotonParticle;
187 gamma->init( GAMM, new4mom );
188 // report(INFO,"EvtGen") << gamma << " " << p << " "<< px << " " << py << " " << pz << "
189 // " << p->getNDaug() << " " << EvtPDL::name(p->getId())<<" " << entry << " "
190 // <<numparticlephotos<<endl;
191 gamma->addDaug( p );
192
193 // p->getDaug(i)->set_type(EvtSpinType::PHOTON);
194 }
195 return;
196}
void begevtgengetx_(int *, int *, int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, double *, double *, double *, double *, double *)
void begevtgenstorex_(int *, int *, int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, double *, double *, double *, double *, double *)
void photos_(int *)
void heplst_(int *)
void phoini_()
double mp
int contains(const EvtId id)
Definition EvtIdSet.cc:382
Definition EvtId.hh:27
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
void doRadCorr(EvtParticle *p)
Definition EvtPHOTOS.cc:44
EvtId getId() const
const EvtVector4R & getP4() const
void setP4(const EvtVector4R &p4)
int getNDaug() const
EvtParticle * getDaug(int i)
double mass() const
void addDaug(EvtParticle *node)
void init(EvtId part_n, double e, double px, double py, double pz)
double get(int i) const
void set(int i, double d)
int t()
Definition t.c:1