BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPythia Class Reference

#include <EvtPythia.hh>

Inheritance diagram for EvtPythia:

Public Member Functions

 EvtPythia ()
virtual ~EvtPythia ()
void getName (std::string &name)
EvtDecayBaseclone ()
void decay (EvtParticle *p)
std::string commandName ()
void command (std::string cmd)
void init ()
void initProbMax ()
Public Member Functions inherited from EvtDecayIncoherent
void makeDecay (EvtParticle *p)
virtual ~EvtDecayIncoherent ()
void setDaughterSpinDensity (int daughter)
int isDaughterSpinDensitySet (int daughter)
Public Member Functions inherited from EvtDecayBase
double getProbMax (double prob)
double resetProbMax (double prob)
 EvtDecayBase ()
virtual ~EvtDecayBase ()
virtual bool matchingDecay (const EvtDecayBase &other) const
EvtId getParentId ()
double getBranchingFraction ()
void disableCheckQ ()
void checkQ ()
int getNDaug ()
EvtIdgetDaugs ()
EvtId getDaug (int i)
int getNArg ()
int getPHOTOS ()
void setPHOTOS ()
void setVerbose ()
void setSummary ()
double * getArgs ()
std::string * getArgsStr ()
double getArg (int j)
std::string getArgStr (int j)
std::string getModelName ()
int getDSum ()
int summary ()
int verbose ()
void saveDecayInfo (EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
void printSummary ()
void setProbMax (double prbmx)
void noProbMax ()
void checkNArg (int a1, int a2=-1, int a3=-1, int a4=-1)
void checkNDaug (int d1, int d2=-1)
void checkSpinParent (EvtSpinType::spintype sp)
void checkSpinDaughter (int d1, EvtSpinType::spintype sp)
virtual int nRealDaughters ()

Static Public Member Functions

static void pythiaInit (int f)
static void pythiacont (double *, int *, int *, double *, double *, double *, double *)
Static Public Member Functions inherited from EvtDecayBase
static void findMasses (EvtParticle *p, int ndaugs, EvtId daugs[10], double masses[10])
static void findMass (EvtParticle *p)
static double findMaxMass (EvtParticle *p)

Additional Inherited Members

Protected Member Functions inherited from EvtDecayBase
bool daugsDecayedByParentModel ()
Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel

Detailed Description

Definition at line 32 of file EvtPythia.hh.

Constructor & Destructor Documentation

◆ EvtPythia()

EvtPythia::EvtPythia ( )

Definition at line 91 of file EvtPythia.cc.

91{}

Referenced by clone().

◆ ~EvtPythia()

EvtPythia::~EvtPythia ( )
virtual

Definition at line 93 of file EvtPythia.cc.

93 {
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}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtPythia::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 126 of file EvtPythia.cc.

126{ return new EvtPythia; }

◆ command()

void EvtPythia::command ( std::string cmd)
virtual

Reimplemented from EvtDecayBase.

Definition at line 150 of file EvtPythia.cc.

150 {
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}

◆ commandName()

std::string EvtPythia::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 148 of file EvtPythia.cc.

148{ return std::string( "JetSetPar" ); }

◆ decay()

void EvtPythia::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 178 of file EvtPythia.cc.

178 {
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];
206 EvtId type[MAX_DAUG];
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}
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
const int MAX_DAUG
DOUBLE_PRECISION count[3]
double mp
struct @125167362051102326102214011354340031122345135231 cbbeam_
void pylist_(int &)
void pythiadec_(int *, double *, int *, int *, int *, double *, double *, double *, double *)
int pycomp_(int *kf)
@ INFO
Definition EvtReport.hh:52
EvtId getParentId()
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static EvtId evtIdFromStdHep(int stdhep)
Definition EvtPDL.cc:232
static std::string name(EvtId i)
Definition EvtPDL.hh:70
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtId getId() const
void setDiagonalSpinDensity()
int getNDaug() const
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
double mass() const
static void pythiaInit(int f)
Definition EvtPythia.cc:909
void set(int i, double d)

◆ getName()

void EvtPythia::getName ( std::string & name)
virtual

Implements EvtDecayBase.

Definition at line 124 of file EvtPythia.cc.

124{ model_name = "PYTHIA"; }

◆ init()

void EvtPythia::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 130 of file EvtPythia.cc.

130 {
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}
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)

◆ initProbMax()

void EvtPythia::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 128 of file EvtPythia.cc.

128{ noProbMax(); }

◆ pythiacont()

void EvtPythia::pythiacont ( double * energy,
int * ndaugjs,
int * kf,
double * px,
double * py,
double * pz,
double * e )
static

Definition at line 173 of file EvtPythia.cc.

174 {
175 pycontinuum_( energy, ndaugjs, kf, px, py, pz, e );
176}
void pycontinuum_(double *, int *, int *, double *, double *, double *, double *)
************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

Referenced by EvtPycont::decay(), and EvtPyGaGa::decay().

◆ pythiaInit()

void EvtPythia::pythiaInit ( int f)
static

Definition at line 909 of file EvtPythia.cc.

909 {
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}
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)
void initpythia_(int *)
void pygive_(const char *cnfgstr, int length)
void evtpythiainit_(const char *fname, int len)
char * c_str(Index i)
Index first(Pair i)

Referenced by EvtPycont::decay(), EvtPyGaGa::decay(), and decay().


The documentation for this class was generated from the following files: