185 {
186
187
188
190
192
196 return;
197 }
198
200
202
203 int i,more;
205 int ndaugjs;
206 int kf[100];
207 EvtId evtnumstable[100],evtnumparton[100];
208 int stableindex[100],partonindex[100];
209 int numstable;
210 int numparton;
211 int km[100];
213
215
216 double px[100],py[100],pz[100],e[100];
217
219
221
222 do{
223
225
226
227 numstable=0;
228 numparton=0;
229
230 for(i=0;i<ndaugjs;i++){
231
233 report(
ERROR,
"EvtGen") <<
"JetSet returned particle:"<<kf[i]<<endl;
234 report(
ERROR,
"EvtGen") <<
"This can not be translated to evt number"<<endl;
235 report(
ERROR,
"EvtGen") <<
"and the decay will be rejected!"<<endl;
236 report(
ERROR,
"EvtGen") <<
"The decay was of particle:"<<ip<<endl;
237
238 }
239
240
241 if (
abs(kf[i])<=6||kf[i]==21){
242 partonindex[numparton]=i;
244 numparton++;
245 }
246 else{
247 stableindex[numstable]=i;
249 numstable++;
250 }
251
252
253
254
255
256
257 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
258
259 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
260
261 }
262
263 p4[i].
set(e[i],px[i],py[i],pz[i]);
264
265
266 }
267
269
270
271 more=(channel!=-1);
272
273
274
275
277
278 }while( more && (count<10000) );
279
280 if (count>9999) {
281 report(
INFO,
"EvtGen") <<
"Too many loops in EvtJetSet!!!"<<endl;
283 for(i=0;i<numstable;i++){
285 }
286
287 }
288
289
290
291 if (numparton==0){
292
294 int ndaugFound=0;
295 for(i=0;i<numstable;i++){
296 p->
getDaug(i)->
init(evtnumstable[i],p4[stableindex[i]]);
297 ndaugFound++;
298 }
299 if ( ndaugFound == 0 ) {
300 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
302 assert(0);
303 }
304
305 fixPolarizations(p);
306
307 return ;
308
309 }
310 else{
311
312
313
315
316 for(i=0;i<numparton;i++){
317 p4string+=p4[partonindex[i]];
318 }
319
320 int nprimary=1;
321 type[0]=STRNG;
322 for(i=0;i<numstable;i++){
323 if (km[stableindex[i]]==0){
324 type[nprimary++]=evtnumstable[i];
325 }
326 }
327
329
331
333
334 for(i=0;i<numparton;i++){
335 p4partons[i]=p4[partonindex[i]];
336 }
337
339
340
341
342 nprimary=1;
343
344 for(i=0;i<numstable;i++){
345
346 if (km[stableindex[i]]==0){
347 p->
getDaug(nprimary++)->
init(evtnumstable[i],p4[stableindex[i]]);
348 }
349 }
350
351
352 int nsecond=0;
353 for(i=0;i<numstable;i++){
354 if (km[stableindex[i]]!=0){
355 type[nsecond++]=evtnumstable[i];
356 }
357 }
358
359
361
362 EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
363 -p4string.get(2),-p4string.get(3));
364
365 nsecond=0;
366 for(i=0;i<numstable;i++){
367 if (km[stableindex[i]]!=0){
368 p4[stableindex[i]]=
boostTo(p4[stableindex[i]],p4stringboost);
372 nsecond++;
373 }
374 }
375
376 if ( nsecond == 0 ) {
377 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
379 assert(0);
380 }
381
382 fixPolarizations(p);
383
384 return ;
385
386 }
387
388}
double abs(const EvtComplex &c)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void jetset1_(int *, double *, int *, int *, int *, double *, double *, double *, double *)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static int getStdHep(EvtId id)
static EvtId evtIdFromStdHep(int stdhep)
static std::string name(EvtId i)
static EvtId getId(const std::string &name)
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void setDiagonalSpinDensity()
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
void set(int i, double d)