BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPythia.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 BelEvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtJetSet.cc
12//
13// Description: Routine to use JetSet for decaying particles.
14//
15// Modification history:
16//
17// RYD July 24, 1997 Module created
18// RS October 28, 2002 copied from JETSET module
19//------------------------------------------------------------------------
20//
21#include "EvtPythia.hh"
29#include <fstream>
30#include <iomanip>
31#include <iostream>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36using std::endl;
37using std::fstream;
38using std::ios;
39using std::ofstream;
40using std::resetiosflags;
41using std::setiosflags;
42using std::setw;
43
44using std::string;
45
46int EvtPythia::njetsetdecays = 0;
47EvtDecayBasePtr* EvtPythia::jetsetdecays = 0;
48int EvtPythia::ntable = 0;
49
50int EvtPythia::ncommand = 0;
51int EvtPythia::lcommand = 0;
52std::string* EvtPythia::commands = 0;
53
54extern "C" {
55extern void pycontinuum_( double*, int*, int*, double*, double*, double*, double* );
56}
57
58extern "C" {
59extern void evtpythiainit_( const char* fname, int len );
60}
61
62extern "C" {
63extern void init_cont_();
64}
65
66extern "C" {
67extern void pythiadec_( int*, double*, int*, int*, int*, double*, double*, double*, double* );
68}
69
70extern "C" {
71extern void initpythia_( int* );
72}
73
74extern "C" {
75extern void pygive_( const char* cnfgstr, int length );
76}
77
78extern "C" {
79extern int pycomp_( int* kf );
80}
81
82extern "C" {
83extern void pylist_( int& );
84}
85
86// common/CBBEAM/MAXIMUM
87extern "C" struct {
88 double maximum;
90
92
94
95 int i;
96
97 // the deletion of commands is really uggly!
98
99 if ( njetsetdecays == 0 )
100 {
101 delete[] commands;
102 commands = 0;
103 return;
104 }
105
106 for ( i = 0; i < njetsetdecays; i++ )
107 {
108 if ( jetsetdecays[i] == this )
109 {
110 jetsetdecays[i] = jetsetdecays[njetsetdecays - 1];
111 njetsetdecays--;
112 if ( njetsetdecays == 0 )
113 {
114 delete[] commands;
115 commands = 0;
116 }
117 return;
118 }
119 }
120
121 report( ERROR, "EvtGen" ) << "Error in destroying Pythia model!" << endl;
122}
123
124void EvtPythia::getName( std::string& model_name ) { model_name = "PYTHIA"; }
125
127
129
131
132 checkNArg( 1 );
133
134 if ( getParentId().isAlias() )
135 {
136
137 report( ERROR, "EvtGen" ) << "EvtPythia finds that you are decaying the" << endl
138 << " aliased particle " << EvtPDL::name( getParentId() ).c_str()
139 << " with the Pythia model" << endl
140 << " this does not work, please modify decay table." << endl;
141 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
142 ::abort();
143 }
144
145 store( this );
146}
147
148std::string EvtPythia::commandName() { return std::string( "JetSetPar" ); }
149
150void EvtPythia::command( std::string cmd ) {
151
152 if ( ncommand == lcommand )
153 {
154
155 lcommand = 10 + 2 * lcommand;
156
157 std::string* newcommands = new std::string[lcommand];
158
159 int i;
160
161 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
162
163 delete[] commands;
164
165 commands = newcommands;
166 }
167
168 commands[ncommand] = cmd;
169
170 ncommand++;
171}
172
173void EvtPythia::pythiacont( double* energy, int* ndaugjs, int* kf, double* px, double* py,
174 double* pz, double* e ) {
175 pycontinuum_( energy, ndaugjs, kf, px, py, pz, e );
176}
177
179
180 // added by Lange Jan4,2000
181 static EvtId STRNG = EvtPDL::getId( "string" );
182
183 int istdheppar = EvtPDL::getStdHep( p->getId() );
184
185 if ( pycomp_( &istdheppar ) == 0 )
186 {
187 report( ERROR, "EvtGen" ) << "Pythia can not decay:" << EvtPDL::name( p->getId() ).c_str()
188 << endl;
189 return;
190 }
191
192 double mp = p->mass();
193
194 EvtVector4R p4[20];
195
196 int i, more;
197 int ip = EvtPDL::getStdHep( p->getId() );
198
199 int ndaugjs;
200 int kf[100];
201 EvtId evtnumstable[100], evtnumparton[100];
202 int stableindex[100], partonindex[100];
203 int numstable;
204 int numparton;
205 int km[100];
207
208 cbbeam_.maximum = mp; // pingrg
209 if ( mp == 0 )
210 {
211 std::cout << "Particle " << EvtPDL::name( p->getId() ) << " has zero mass" << std::endl;
212 abort();
213 }
214 pythiaInit( 0 );
215
216 double px[100], py[100], pz[100], e[100];
217 if ( p->getNDaug() != 0 ) { p->deleteDaughters( true ); }
218
219 int count = 0;
220
221 do {
222
223 pythiadec_( &ip, &mp, &ndaugjs, kf, km, px, py, pz, e );
224
225 numstable = 0;
226 numparton = 0;
227
228 for ( i = 0; i < ndaugjs; i++ )
229 {
230 // std::cout<<"EvtPDL::evtIdFromStdHep(kf[i]),i= "<<i<<"
231 // "<<EvtPDL::evtIdFromStdHep(kf[i])<<std::endl;
232 if ( EvtPDL::evtIdFromStdHep( kf[i] ) == EvtId( -1, -1 ) )
233 {
234 report( ERROR, "EvtGen" ) << "Pythia returned particle:" << kf[i] << endl;
235 report( ERROR, "EvtGen" ) << "This can not be translated to evt number" << endl;
236 report( ERROR, "EvtGen" ) << "and the decay will be rejected!" << endl;
237 report( ERROR, "EvtGen" ) << "The decay was of particle:" << ip << endl;
238 int i = 1;
239 pylist_( i );
240 }
241
242 // sort out the partons
243 if ( abs( kf[i] ) <= 6 || kf[i] == 21 )
244 {
245 partonindex[numparton] = i;
246 evtnumparton[numparton] = EvtPDL::evtIdFromStdHep( kf[i] );
247 numparton++;
248 }
249 else
250 {
251 stableindex[numstable] = i;
252 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( kf[i] );
253 numstable++;
254 }
255
256 // have to protect against negative mass^2 for massless particles
257 // i.e. neutrinos and photons.
258 // this is uggly but I need to fix it right now....
259
260 if ( px[i] * px[i] + py[i] * py[i] + pz[i] * pz[i] >= e[i] * e[i] )
261 { e[i] = sqrt( px[i] * px[i] + py[i] * py[i] + pz[i] * pz[i] ) + 0.0000000000001; }
262
263 p4[i].set( e[i], px[i], py[i], pz[i] );
264 }
265
266 int channel = EvtDecayTable::inChannelList( p->getId(), numstable, evtnumstable );
267
268 more = ( channel != -1 );
269
270 count++;
271
272 } while ( more && ( count < 10000 ) );
273
274 if ( count > 9999 )
275 {
276 report( INFO, "EvtGen" ) << "Too many loops in EvtPythia!!!" << endl;
277 report( INFO, "EvtGen" ) << "Parent:" << EvtPDL::name( getParentId() ).c_str() << endl;
278 for ( i = 0; i < numstable; i++ )
279 {
280 report( INFO, "EvtGen" ) << "Daug(" << i << ")"
281 << EvtPDL::name( evtnumstable[i] ).c_str() << endl;
282 }
283 }
284
285 if ( numparton == 0 )
286 {
287
288 p->makeDaughters( numstable, evtnumstable );
289
290 for ( i = 0; i < numstable; i++ )
291 { p->getDaug( i )->init( evtnumstable[i], p4[stableindex[i]] ); }
292
293 fixPolarizations( p );
294
295 return;
296 }
297 else
298 {
299
300 // have partons in JETSET
301
302 EvtVector4R p4string( 0.0, 0.0, 0.0, 0.0 );
303
304 for ( i = 0; i < numparton; i++ ) { p4string += p4[partonindex[i]]; }
305
306 int nprimary = 1;
307 type[0] = STRNG;
308 for ( i = 0; i < numstable; i++ )
309 {
310 if ( km[stableindex[i]] == 0 ) { type[nprimary++] = evtnumstable[i]; }
311 }
312
313 p->makeDaughters( nprimary, type );
314
315 p->getDaug( 0 )->init( STRNG, p4string );
316
317 EvtVector4R p4partons[10];
318
319 for ( i = 0; i < numparton; i++ ) { p4partons[i] = p4[partonindex[i]]; }
320
321 ( (EvtStringParticle*)p->getDaug( 0 ) )->initPartons( numparton, p4partons, evtnumparton );
322
323 nprimary = 1;
324
325 for ( i = 0; i < numstable; i++ )
326 {
327
328 if ( km[stableindex[i]] == 0 )
329 { p->getDaug( nprimary++ )->init( evtnumstable[i], p4[stableindex[i]] ); }
330 }
331
332 int nsecond = 0;
333 for ( i = 0; i < numstable; i++ )
334 {
335 if ( km[stableindex[i]] != 0 ) { type[nsecond++] = evtnumstable[i]; }
336 }
337
338 p->getDaug( 0 )->makeDaughters( nsecond, type );
339
340 nsecond = 0;
341 for ( i = 0; i < numstable; i++ )
342 {
343 if ( km[stableindex[i]] != 0 )
344 {
345 p4[stableindex[i]] = boostTo( p4[stableindex[i]], p4string );
346 p->getDaug( 0 )->getDaug( nsecond )->init( evtnumstable[i], p4[stableindex[i]] );
347 p->getDaug( 0 )->getDaug( nsecond )->setDiagonalSpinDensity();
348 p->getDaug( 0 )->getDaug( nsecond )->decay();
349 nsecond++;
350 }
351 }
352
353 fixPolarizations( p );
354
355 return;
356 }
357}
358
359void EvtPythia::fixPolarizations( EvtParticle* p ) {
360
361 // special case for now to handle the J/psi polarization
362
363 int ndaug = p->getNDaug();
364
365 int i;
366
367 static EvtId Jpsi = EvtPDL::getId( "J/psi" );
368
369 for ( i = 0; i < ndaug; i++ )
370 {
371 if ( p->getDaug( i )->getId() == Jpsi )
372 {
373
374 EvtSpinDensity rho;
375
376 rho.SetDim( 3 );
377 rho.Set( 0, 0, 0.5 );
378 rho.Set( 0, 1, 0.0 );
379 rho.Set( 0, 2, 0.0 );
380
381 rho.Set( 1, 0, 0.0 );
382 rho.Set( 1, 1, 1.0 );
383 rho.Set( 1, 2, 0.0 );
384
385 rho.Set( 2, 0, 0.0 );
386 rho.Set( 2, 1, 0.0 );
387 rho.Set( 2, 2, 0.5 );
388
389 EvtVector4R p4Psi = p->getDaug( i )->getP4();
390
391 double alpha = atan2( p4Psi.get( 2 ), p4Psi.get( 1 ) );
392 double beta = acos( p4Psi.get( 3 ) / p4Psi.d3mag() );
393
394 p->getDaug( i )->setSpinDensityForwardHelicityBasis( rho, alpha, beta, 0.0 );
396 }
397 }
398}
399
400void EvtPythia::store( EvtDecayBase* jsdecay ) {
401
402 if ( njetsetdecays == ntable )
403 {
404
405 EvtDecayBasePtr* newjetsetdecays = new EvtDecayBasePtr[2 * ntable + 10];
406 int i;
407 for ( i = 0; i < ntable; i++ ) { newjetsetdecays[i] = jetsetdecays[i]; }
408 ntable = 2 * ntable + 10;
409 delete[] jetsetdecays;
410 jetsetdecays = newjetsetdecays;
411 }
412
413 jetsetdecays[njetsetdecays++] = jsdecay;
414}
415
416void EvtPythia::WritePythiaEntryHeader( ofstream& outdec, int lundkc, EvtId evtnum,
417 std::string name, int chg, int cchg, int spin2,
418 double mass, double width, double maxwidth,
419 double ctau, int stable, double rawbrfrsum ) {
420
421 char sname[100];
422 char ccsname[100];
423
424 // RS changed to 16, new PYTHIA standard
425 int namelength = 16;
426
427 int i, j;
428 int temp;
429 temp = spin2;
430
431 if ( ctau > 1000000.0 ) ctau = 0.0;
432
433 strcpy( sname, name.c_str() );
434
435 i = 0;
436
437 while ( sname[i] != 0 ) { i++; }
438
439 // strip up to two + or -
440
441 if ( evtnum.getId() >= 0 )
442 {
443 if ( sname[i - 1] == '+' || sname[i - 1] == '-' )
444 {
445 sname[i - 1] = 0;
446 i--;
447 }
448 if ( sname[i - 1] == '+' || sname[i - 1] == '-' )
449 {
450 sname[i - 1] = 0;
451 i--;
452 }
453 // strip 0 except for _0 and chi...0
454 if ( sname[i - 1] == '0' && sname[i - 2] != '_' &&
455 !( sname[0] == 'c' && sname[1] == 'h' ) )
456 {
457 sname[i - 1] = 0;
458 i--;
459 }
460 }
461
462 if ( i > namelength )
463 {
464 for ( j = 1; j < namelength; j++ ) { sname[j] = sname[j + i - namelength]; }
465 sname[namelength] = 0;
466 }
467
468 // RS: copy name for cc particle
469 for ( j = 0; j <= namelength; j++ ) ccsname[j] = sname[j];
470 i = 0;
471 while ( ccsname[i] != ' ' )
472 {
473 i++;
474 if ( ccsname[i] == 0 ) break;
475 }
476 if ( i < namelength )
477 {
478 ccsname[i] = 'b';
479 ccsname[i + 1] = 0;
480 }
481
482 // cchg=0;
483
484 if ( evtnum.getId() >= 0 )
485 {
486 if ( abs( EvtPDL::getStdHep( evtnum ) ) == 21 ) cchg = 2;
487 if ( abs( EvtPDL::getStdHep( evtnum ) ) == 90 ) cchg = -1;
488 if ( ( abs( EvtPDL::getStdHep( evtnum ) ) <= 8 ) &&
489 ( abs( EvtPDL::getStdHep( evtnum ) ) != 0 ) )
490 cchg = 1;
491 }
492
493 // RS output format changed to new PYTHIA style
494 outdec << " " << setw( 9 ) << lundkc;
495 outdec << " ";
496 outdec.width( namelength );
497 outdec << setiosflags( ios::left ) << sname;
498 // RS: name for cc paricle
499 if ( ( evtnum.getId() >= 0 ) && ( EvtPDL::chargeConj( evtnum ) != evtnum ) )
500 {
501 outdec << " ";
502 outdec.width( namelength );
503 outdec << ccsname;
504 }
505 else
506 {
507 // 2+16 spaces
508 outdec << " ";
509 }
510
511 outdec << resetiosflags( ios::left );
512 outdec << setw( 3 ) << chg;
513 outdec << setw( 3 ) << cchg;
514 outdec.width( 3 );
515 if ( evtnum.getId() >= 0 )
516 {
517 if ( EvtPDL::chargeConj( evtnum ) == evtnum ) { outdec << 0; }
518 else { outdec << 1; }
519 }
520 else { outdec << 0; }
521 outdec.setf( ios::fixed, ios::floatfield );
522 outdec.precision( 5 );
523 outdec << setw( 12 ) << mass;
524 outdec.setf( ios::fixed, ios::floatfield );
525 outdec << setw( 12 ) << width;
526 outdec.setf( ios::fixed, ios::floatfield );
527 outdec.width( 12 );
528 if ( fabs( width ) < 0.0000000001 ) { outdec << 0.0; }
529 else { outdec << maxwidth; }
530 // scientific notation ... outdec << setw(14) << ctau;
531 outdec.setf( ios::scientific, ios::floatfield );
532 outdec << " ";
533 outdec << ctau;
534 outdec.width( 3 );
535 if ( evtnum.getId() >= 0 )
536 {
537 if ( ctau > 1.0 || rawbrfrsum < 0.000001 ) { stable = 0; }
538 }
539 // resonance width treatment
540 outdec.width( 3 );
541 outdec << 0;
542 outdec.width( 3 );
543 outdec << stable;
544 outdec << endl;
545 outdec.width( 0 );
546 // outdec.setf(0,0);
547}
548
549void EvtPythia::WritePythiaParticle( ofstream& outdec, EvtId ipar, EvtId iparname,
550 int& first ) {
551
552 int ijetset;
553
554 double br_sum = 0.0;
555
556 for ( ijetset = 0; ijetset < njetsetdecays; ijetset++ )
557 {
558
559 if ( jetsetdecays[ijetset]->getParentId() == ipar )
560 { br_sum += jetsetdecays[ijetset]->getBranchingFraction(); }
561 if ( jetsetdecays[ijetset]->getParentId() !=
562 EvtPDL::chargeConj( jetsetdecays[ijetset]->getParentId() ) &&
563 EvtPDL::chargeConj( jetsetdecays[ijetset]->getParentId() ) == ipar )
564 { br_sum += jetsetdecays[ijetset]->getBranchingFraction(); }
565 }
566
567 double br_sum_true = br_sum;
568
569 if ( br_sum < 0.000001 ) br_sum = 1.0;
570
571 for ( ijetset = 0; ijetset < njetsetdecays; ijetset++ )
572 {
573 if ( jetsetdecays[ijetset]->getParentId() == ipar )
574 {
575
576 double br = jetsetdecays[ijetset]->getBranchingFraction();
577
578 int i, daugs[5];
579 EvtId cdaugs[5];
580
581 for ( i = 0; i < 5; i++ )
582 {
583
584 if ( i < jetsetdecays[ijetset]->getNDaug() )
585 {
586 daugs[i] = EvtPDL::getStdHep( jetsetdecays[ijetset]->getDaugs()[i] );
587 cdaugs[i] = EvtPDL::chargeConj( jetsetdecays[ijetset]->getDaugs()[i] );
588 }
589 else { daugs[i] = 0; }
590 }
591
592 int channel;
593
595 EvtPDL::chargeConj( ipar ), jetsetdecays[ijetset]->getModelName(),
596 jetsetdecays[ijetset]->getNDaug(), cdaugs, jetsetdecays[ijetset]->getNArg(),
597 jetsetdecays[ijetset]->getArgsStr() );
598
599 if ( jetsetdecays[ijetset]->getModelName() == "PYTHIA" )
600 {
601
602 if ( first )
603 {
604 first = 0;
605 WritePythiaEntryHeader( outdec,
606 // EvtPDL::getLundKC(iparname),
607 EvtPDL::getStdHep( iparname ), iparname,
608 EvtPDL::name( iparname ), EvtPDL::chg3( iparname ), 0, 0,
609 EvtPDL::getMeanMass( ipar ), EvtPDL::getWidth( ipar ),
610 EvtPDL::getMeanMass( ipar ) - EvtPDL::getMinMass( ipar ),
611 EvtPDL::getctau( ipar ), 1, br_sum_true );
612 }
613
614 int dflag = 2;
615
616 if ( EvtPDL::getStdHep( ipar ) < 0 )
617 {
618 dflag = 3;
619 for ( i = 0; i < jetsetdecays[ijetset]->getNDaug(); i++ )
620 { daugs[i] = EvtPDL::getStdHep( cdaugs[i] ); }
621 }
622
623 /* RS
624 PYTHIA allows to introduce new particles via a call to PYUPDA
625 so no need for this check any more
626
627 //now lets check to make sure that jetset, lucomp, knows
628 //about all particles!
629 int unknown=0;
630 for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
631 if (pycomp_(&daugs[i])==0) {
632 unknown=1;
633 report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
634 << "know the particle:"<<
635 EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<endl;
636 }
637 }
638
639 int istdheppar=EvtPDL::getStdHep(ipar);
640
641 if (pycomp_(&istdheppar)==0){
642 unknown=1;
643 report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
644 << "know the particle:"<<
645 EvtPDL::name(ipar)<<endl;
646 }
647
648
649
650 if (unknown){
651 report(ERROR,"EvtGen") << "Therfore the decay:"<<endl;
652 report(ERROR,"EvtGen") << EvtPDL::name(jetsetdecays[ijetset]->getParentId())<<" -> ";
653 for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
654 report(ERROR,"") << EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<" ";
655 }
656 report(ERROR,"")<<endl;
657 report(ERROR,"EvtGen")<<"Will not be generated."<<endl;
658 return;
659 }
660 */
661
662 if ( EvtPDL::chargeConj( ipar ) == ipar )
663 {
664 dflag = 1;
665 // report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because
666 // C(ipar)=ipar!"<<endl;
667 }
668
669 // if (channel>=0) {
670 // dflag=1;
671 // report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because
672 // channel>=0"<<endl;
673 // }
674
675 // if (!(EvtPDL::getStdHep(ipar)<0&&channel>=0)){
676 if ( 1 )
677 {
678
679 // RS changed format to new PYTHIA one
680 outdec << " ";
681 outdec.width( 5 );
682 outdec << dflag;
683 outdec.width( 5 );
684 outdec << (int)jetsetdecays[ijetset]->getArgs()[0];
685 outdec.width( 12 );
686 if ( fabs( br ) < 0.000000001 ) { outdec << "0.00000"; }
687 else { outdec << br / br_sum; }
688 outdec.width( 10 );
689 outdec << daugs[0];
690 outdec.width( 10 );
691 outdec << daugs[1];
692 outdec.width( 10 );
693 outdec << daugs[2];
694 outdec.width( 10 );
695 outdec << daugs[3];
696 outdec.width( 10 );
697 outdec << daugs[4];
698 outdec << endl;
699 outdec.width( 0 );
700 }
701 }
702 }
703 }
704}
705
706bool EvtPythia::diquark( int ID ) {
707 switch ( ID )
708 {
709 case 1103:
710 case 2101:
711 case 2103:
712 case 2203:
713 case 3101:
714 case 3103:
715 case 3201:
716 case 3203:
717 case 3303:
718 case 4101:
719 case 4103:
720 case 4201:
721 case 4203:
722 case 4301:
723 case 4303:
724 case 4403:
725 case 5101:
726 case 5103:
727 case 5201:
728 case 5203:
729 case 5301:
730 case 5303:
731 case 5401:
732 case 5403:
733 case 5503: return true; break;
734 default: return false; break;
735 }
736}
737
738double EvtPythia::NominalMass( int ID ) {
739 // return default mass in PYTHIA
740 switch ( ID )
741 {
742 case 1103: return 0.77133;
743 case 2101: return 0.57933;
744 case 2103: return 0.77133;
745 case 2203: return 0.77133;
746 case 3101: return 0.80473;
747 case 3103: return 0.92953;
748 case 3201: return 0.80473;
749 case 3203: return 0.92953;
750 case 3303: return 1.09361;
751 case 4101: return 1.96908;
752 case 4103: return 2.00808;
753 case 4201: return 1.96908;
754 case 4203: return 2.00808;
755 case 4301: return 2.15432;
756 case 4303: return 2.17967;
757 case 4403: return 3.27531;
758 case 5101: return 5.38897;
759 case 5103: return 5.40145;
760 case 5201: return 5.38897;
761 case 5203: return 5.40145;
762 case 5301: return 5.56725;
763 case 5303: return 5.57536;
764 case 5401: return 6.67143;
765 case 5403: return 6.67397;
766 case 5503: return 10.07354; break;
767 default: return 0.0; break;
768 }
769}
770
771int NominalCharge( int ID ) {
772 // return default mass in PYTHIA
773 switch ( ID )
774 {
775 case 1103: return -2;
776 case 2101: return 1;
777 case 2103: return 1;
778 case 2203: return 4;
779 case 3101: return -2;
780 case 3103: return -2;
781 case 3201: return 1;
782 case 3203: return 1;
783 case 3303: return -2;
784 case 4101: return 1;
785 case 4103: return 1;
786 case 4201: return 4;
787 case 4203: return 4;
788 case 4301: return 1;
789 case 4303: return 1;
790 case 4403: return 4;
791 case 5101: return -2;
792 case 5103: return -2;
793 case 5201: return 1;
794 case 5203: return 1;
795 case 5301: return -2;
796 case 5303: return -2;
797 case 5401: return 1;
798 case 5403: return 1;
799 case 5503: return -2; break;
800 default: return 0; break;
801 }
802}
803
804void EvtPythia::MakePythiaFile( char* fname ) {
805
806 EvtId ipar;
807 int lundkc;
808
809 // int part_list[MAX_PART];
810
811 ofstream outdec;
812
813 outdec.open( fname );
814
815 // outdec << "ERROR;"<<endl;
816 // outdec << ";"<<endl;
817 // outdec << ";This decayfile has been automatically created by"<<endl;
818 // outdec << ";EvtGen from the DECAY.DEC file"<<endl;
819 // outdec << ";"<<endl;
820
821 int nokcentry;
822
823 for ( lundkc = 1; lundkc < 500; lundkc++ )
824 {
825
826 nokcentry = 1;
827
828 int iipar;
829
830 for ( iipar = 0; iipar < EvtPDL::entries(); iipar++ )
831 {
832
833 ipar = EvtId( iipar, iipar );
834 // no aliased particles!
835 std::string tempStr = EvtPDL::name( ipar );
836 EvtId realId = EvtPDL::getId( tempStr );
837 if ( realId.isAlias() != 0 ) continue;
838
839 if ( !( EvtPDL::getStdHep( ipar ) == 21 || EvtPDL::getStdHep( ipar ) == 22 ||
840 EvtPDL::getStdHep( ipar ) == 23 ) )
841 {
842
843 if ( lundkc == EvtPDL::getLundKC( ipar ) )
844 {
845
846 nokcentry = 0;
847
848 int first = 1;
849
850 WritePythiaParticle( outdec, ipar, ipar, first );
851
852 EvtId ipar2 = EvtPDL::chargeConj( ipar );
853
854 if ( ipar2 != ipar ) { WritePythiaParticle( outdec, ipar2, ipar, first ); }
855
856 if ( first )
857 {
858 WritePythiaEntryHeader( outdec,
859 // EvtPDL::getLundKC(ipar),
860 EvtPDL::getStdHep( ipar ), ipar, EvtPDL::name( ipar ),
861 EvtPDL::chg3( ipar ), 0, 0, EvtPDL::getMeanMass( ipar ),
862 EvtPDL::getWidth( ipar ),
863 EvtPDL::getMeanMass( ipar ) - EvtPDL::getMinMass( ipar ),
864 EvtPDL::getctau( ipar ), 0, 0.0 );
865 }
866 }
867 }
868 }
869 if ( lundkc == 99999 ) // Write out diquarks after quarks, but only once
870 for ( iipar = 0; iipar < EvtPDL::entries(); iipar++ )
871 {
872
873 ipar = EvtId( iipar, iipar );
874
875 if ( diquark( EvtPDL::getStdHep( ipar ) ) )
876 {
877
878 nokcentry = 0;
879
880 int first = 1;
881
882 WritePythiaParticle( outdec, ipar, ipar, first );
883
884 EvtId ipar2 = EvtPDL::chargeConj( ipar );
885
886 if ( ipar2 != ipar ) { WritePythiaParticle( outdec, ipar2, ipar, first ); }
887
888 if ( first )
889 {
890 WritePythiaEntryHeader(
891 outdec, EvtPDL::getStdHep( ipar ), ipar, EvtPDL::name( ipar ),
892 NominalCharge( EvtPDL::getStdHep( ipar ) ), -1, 0,
893 NominalMass( EvtPDL::getStdHep( ipar ) ), 0, 0, 0, 0, 0.0 );
894 }
895 }
896 }
897 /* if (nokcentry){
898
899 WritePythiaEntryHeader(outdec,
900 lundkc,EvtId(-1,-1)," ",
901 0,0,0,EvtPDL::getNominalMass(ipar),0.0,0.0,
902 EvtPDL::getctau(ipar),0,0.0);
903
904 } */
905 }
906 outdec.close();
907}
908
909void EvtPythia::pythiaInit( int dummy ) {
910
911 static int first = 1;
912 if ( first )
913 {
914
915 first = 0;
916
917 report( INFO, "EvtGen" ) << "Will initialize Pythia." << endl;
918 for ( int i = 0; i < ncommand; i++ )
919 pygive_( commands[i].c_str(), strlen( commands[i].c_str() ) );
920
921 char fname[200];
922
923 char hostBuffer[100];
924
925 if ( gethostname( hostBuffer, 100 ) != 0 )
926 {
927 report( ERROR, "EvtGen" ) << " couldn't get hostname." << endl;
928 strncpy( hostBuffer, "hostnameNotFound", 100 );
929 }
930
931 char pid[100];
932
933 int thePid = getpid();
934
935 if ( sprintf( pid, "%d", thePid ) == 0 )
936 {
937 report( ERROR, "EvtGen" ) << " couldn't get process ID." << endl;
938 strncpy( pid, "666", 100 );
939 }
940
941 strcpy( fname, "jet.d-" );
942 strcat( fname, hostBuffer );
943 strcat( fname, "-" );
944 strcat( fname, pid );
945
946 MakePythiaFile( fname );
947 evtpythiainit_( fname, strlen( fname ) );
948 initpythia_( &dummy );
949
950 if ( 0 == getenv( "EVTSAVEJETD" ) )
951 {
952 char delcmd[300];
953 strcpy( delcmd, "rm -f " );
954 strcat( delcmd, fname );
955 system( delcmd );
956 }
957
958 report( INFO, "EvtGen" ) << "Done initializing Pythia." << endl;
959 }
960}
double mass
sprintf(cut, "kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_" "pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
EvtDecayBase * EvtDecayBasePtr
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
const int MAX_DAUG
DOUBLE_PRECISION count[3]
double alpha
double mp
double maximum
Definition EvtPycont.cc:38
struct @125167362051102326102214011354340031122345135231 cbbeam_
void initpythia_(int *)
int NominalCharge(int ID)
Definition EvtPythia.cc:771
void init_cont_()
void pygive_(const char *cnfgstr, int length)
void pycontinuum_(double *, int *, int *, double *, double *, double *, double *)
void pylist_(int &)
void evtpythiainit_(const char *fname, int len)
void pythiadec_(int *, double *, int *, int *, int *, double *, double *, double *, double *)
void initpythia_(int *)
int pycomp_(int *kf)
EvtDecayBase * EvtDecayBasePtr
Definition EvtPythia.hh:30
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
@ INFO
Definition EvtReport.hh:52
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
std::string * getArgsStr()
std::string getModelName()
EvtId getParentId()
double * getArgs()
EvtId * getDaugs()
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
void setDaughterSpinDensity(int daughter)
static int findChannel(EvtId parent, std::string model, int ndaug, EvtId *daugs, int narg, std::string *args)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
Definition EvtId.hh:27
int getId() const
Definition EvtId.hh:40
int isAlias() const
Definition EvtId.hh:44
static double getWidth(EvtId i)
Definition EvtPDL.hh:59
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static double getMeanMass(EvtId i)
Definition EvtPDL.hh:43
static int entries()
Definition EvtPDL.hh:73
static EvtId evtIdFromStdHep(int stdhep)
Definition EvtPDL.cc:232
static std::string name(EvtId i)
Definition EvtPDL.hh:70
static EvtId chargeConj(EvtId id)
Definition EvtPDL.cc:193
static double getMinMass(EvtId i)
Definition EvtPDL.hh:56
static int chg3(EvtId i)
Definition EvtPDL.hh:65
static int getLundKC(EvtId id)
Definition EvtPDL.hh:62
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
static double getctau(EvtId i)
Definition EvtPDL.hh:60
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtId getId() const
void setDiagonalSpinDensity()
const EvtVector4R & getP4() const
int getNDaug() const
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
double mass() const
static void pythiaInit(int f)
Definition EvtPythia.cc:909
virtual ~EvtPythia()
Definition EvtPythia.cc:93
void initProbMax()
Definition EvtPythia.cc:128
static void pythiacont(double *, int *, int *, double *, double *, double *, double *)
Definition EvtPythia.cc:173
void command(std::string cmd)
Definition EvtPythia.cc:150
void decay(EvtParticle *p)
Definition EvtPythia.cc:178
void getName(std::string &name)
Definition EvtPythia.cc:124
std::string commandName()
Definition EvtPythia.cc:148
EvtDecayBase * clone()
Definition EvtPythia.cc:126
void init()
Definition EvtPythia.cc:130
void Set(int i, int j, const EvtComplex &rhoij)
void SetDim(int n)
double get(int i) const
double d3mag() const
void set(int i, double d)
Index first(Pair i)