BOSS 7.0.9
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 ()
 
 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)
 
void makeDecay (EvtParticle *p)
 
virtual ~EvtDecayIncoherent ()
 
void setDaughterSpinDensity (int daughter)
 
int isDaughterSpinDensitySet (int daughter)
 
- Public Member Functions inherited from EvtDecayBase
virtual void getName (std::string &name)=0
 
virtual void decay (EvtParticle *p)=0
 
virtual void makeDecay (EvtParticle *p)=0
 
virtual EvtDecayBaseclone ()=0
 
virtual void init ()
 
virtual void initProbMax ()
 
virtual std::string commandName ()
 
virtual void command (std::string cmd)
 
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 ()
 
virtual void getName (std::string &name)=0
 
virtual void decay (EvtParticle *p)=0
 
virtual void makeDecay (EvtParticle *p)=0
 
virtual EvtDecayBaseclone ()=0
 
virtual void init ()
 
virtual void initProbMax ()
 
virtual std::string commandName ()
 
virtual void command (std::string cmd)
 
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 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)
 
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 ()
 
bool daugsDecayedByParentModel ()
 
- Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel
 

Detailed Description

Constructor & Destructor Documentation

◆ EvtPythia() [1/2]

EvtPythia::EvtPythia ( )

Definition at line 94 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

94{}

Referenced by clone().

◆ ~EvtPythia() [1/2]

EvtPythia::~EvtPythia ( )
virtual

Definition at line 96 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

96 {
97
98
99 int i;
100
101
102 //the deletion of commands is really uggly!
103
104 if (njetsetdecays==0) {
105 delete [] commands;
106 commands=0;
107 return;
108 }
109
110 for(i=0;i<njetsetdecays;i++){
111 if (jetsetdecays[i]==this){
112 jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
113 njetsetdecays--;
114 if (njetsetdecays==0) {
115 delete [] commands;
116 commands=0;
117 }
118 return;
119 }
120 }
121
122 report(ERROR,"EvtGen") << "Error in destroying Pythia model!"<<endl;
123
124}
ostream & report(Severity severity, const char *facility)

◆ EvtPythia() [2/2]

EvtPythia::EvtPythia ( )

◆ ~EvtPythia() [2/2]

virtual EvtPythia::~EvtPythia ( )
virtual

Member Function Documentation

◆ clone() [1/2]

EvtDecayBase * EvtPythia::clone ( )
virtual

◆ clone() [2/2]

EvtDecayBase * EvtPythia::clone ( )
virtual

Implements EvtDecayBase.

◆ command() [1/2]

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

Reimplemented from EvtDecayBase.

Definition at line 177 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

177 {
178
179 if (ncommand==lcommand){
180
181 lcommand=10+2*lcommand;
182
183 std::string* newcommands=new std::string[lcommand];
184
185 int i;
186
187 for(i=0;i<ncommand;i++){
188 newcommands[i]=commands[i];
189 }
190
191 delete [] commands;
192
193 commands=newcommands;
194
195 }
196
197 commands[ncommand]=cmd;
198
199 ncommand++;
200
201}

◆ command() [2/2]

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

Reimplemented from EvtDecayBase.

◆ commandName() [1/2]

std::string EvtPythia::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 170 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

170 {
171
172 return std::string("JetSetPar");
173
174}

◆ commandName() [2/2]

std::string EvtPythia::commandName ( )
virtual

Reimplemented from EvtDecayBase.

◆ decay() [1/2]

void EvtPythia::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 211 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

211 {
212
213 //added by Lange Jan4,2000
214 static EvtId STRNG=EvtPDL::getId("string");
215
216 int istdheppar=EvtPDL::getStdHep(p->getId());
217
218 if (pycomp_(&istdheppar)==0){
219 report(ERROR,"EvtGen") << "Pythia can not decay:"
220 <<EvtPDL::name(p->getId()).c_str()<<endl;
221 return;
222 }
223
224
225 double mp=p->mass();
226
227 EvtVector4R p4[20];
228
229 int i,more;
230 int ip=EvtPDL::getStdHep(p->getId());
231
232 int ndaugjs;
233 int kf[100];
234 EvtId evtnumstable[100],evtnumparton[100];
235 int stableindex[100],partonindex[100];
236 int numstable;
237 int numparton;
238 int km[100];
239 EvtId type[MAX_DAUG];
240
241 cbbeam_.maximum = mp; //pingrg
242 if(mp==0){std::cout<<"Particle "<<EvtPDL::name(p->getId())<<" has zero mass"<<std::endl;abort();}
243 pythiaInit(0);
244
245 double px[100],py[100],pz[100],e[100];
246 if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
247
248 int count=0;
249
250 do{
251
252 pythiadec_(&ip,&mp,&ndaugjs,kf,km,px,py,pz,e);
253
254
255 numstable=0;
256 numparton=0;
257
258 for(i=0;i<ndaugjs;i++){
259 // std::cout<<"EvtPDL::evtIdFromStdHep(kf[i]),i= "<<i<<" "<<EvtPDL::evtIdFromStdHep(kf[i])<<std::endl;
260 if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
261 report(ERROR,"EvtGen") << "Pythia returned particle:"<<kf[i]<<endl;
262 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
263 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
264 report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
265 int i=1;
266 pylist_(i);
267 }
268
269 //sort out the partons
270 if (abs(kf[i])<=6||kf[i]==21){
271 partonindex[numparton]=i;
272 evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
273 numparton++;
274 }
275 else{
276 stableindex[numstable]=i;
277 evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]);
278 numstable++;
279 }
280
281
282 // have to protect against negative mass^2 for massless particles
283 // i.e. neutrinos and photons.
284 // this is uggly but I need to fix it right now....
285
286 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
287
288 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
289
290 }
291
292 p4[i].set(e[i],px[i],py[i],pz[i]);
293
294
295 }
296
297 int channel= EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
298
299 more=(channel!=-1);
300
301
302 count++;
303
304 }while( more && (count<10000) );
305
306
307 if (count>9999) {
308 report(INFO,"EvtGen") << "Too many loops in EvtPythia!!!"<<endl;
309 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
310 for(i=0;i<numstable;i++){
311 report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
312 }
313
314 }
315
316
317
318 if (numparton==0){
319
320 p->makeDaughters(numstable,evtnumstable);
321
322 for(i=0;i<numstable;i++){
323 p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
324 }
325
326 fixPolarizations(p);
327
328 return ;
329
330 }
331 else{
332
333 //have partons in JETSET
334
335 EvtVector4R p4string(0.0,0.0,0.0,0.0);
336
337 for(i=0;i<numparton;i++){
338 p4string+=p4[partonindex[i]];
339 }
340
341 int nprimary=1;
342 type[0]=STRNG;
343 for(i=0;i<numstable;i++){
344 if (km[stableindex[i]]==0){
345 type[nprimary++]=evtnumstable[i];
346 }
347 }
348
349 p->makeDaughters(nprimary,type);
350
351 p->getDaug(0)->init(STRNG,p4string);
352
353 EvtVector4R p4partons[10];
354
355 for(i=0;i<numparton;i++){
356 p4partons[i]=p4[partonindex[i]];
357 }
358
359 ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
360
361
362
363 nprimary=1;
364
365 for(i=0;i<numstable;i++){
366
367 if (km[stableindex[i]]==0){
368 p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
369 }
370 }
371
372
373 int nsecond=0;
374 for(i=0;i<numstable;i++){
375 if (km[stableindex[i]]!=0){
376 type[nsecond++]=evtnumstable[i];
377 }
378 }
379
380
381 p->getDaug(0)->makeDaughters(nsecond,type);
382
383 nsecond=0;
384 for(i=0;i<numstable;i++){
385 if (km[stableindex[i]]!=0){
386 p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4string);
387 p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
388 p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
389 p->getDaug(0)->getDaug(nsecond)->decay();
390 nsecond++;
391 }
392 }
393
394 fixPolarizations(p);
395
396 return ;
397
398 }
399
400}
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
struct @18 cbbeam_
void pylist_(int &)
void pythiadec_(int *, double *, int *, int *, int *, double *, double *, double *, double *)
int pycomp_(int *kf)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static EvtId getId(const std::string &name)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
const double mp
Definition: incllambda.cxx:45

◆ decay() [2/2]

void EvtPythia::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

◆ getName() [1/2]

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

Implements EvtDecayBase.

Definition at line 127 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

127 {
128
129 model_name="PYTHIA";
130
131}

◆ getName() [2/2]

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

Implements EvtDecayBase.

◆ init() [1/2]

void EvtPythia::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 147 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

147 {
148
149 checkNArg(1);
150
151
152 if (getParentId().isAlias()){
153
154 report(ERROR,"EvtGen") << "EvtPythia finds that you are decaying the"<<endl
155 << " aliased particle "
156 << EvtPDL::name(getParentId()).c_str()
157 << " with the Pythia model"<<endl
158 << " this does not work, please modify decay table."
159 << endl;
160 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
161 ::abort();
162
163 }
164
165 store(this);
166
167}
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)

◆ init() [2/2]

void EvtPythia::init ( )
virtual

Reimplemented from EvtDecayBase.

◆ initProbMax() [1/2]

void EvtPythia::initProbMax ( )
virtual

◆ initProbMax() [2/2]

void EvtPythia::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

◆ pythiacont() [1/2]

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

Definition at line 203 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

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

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

◆ pythiacont() [2/2]

static void EvtPythia::pythiacont ( double *  ,
int *  ,
int *  ,
double *  ,
double *  ,
double *  ,
double *   
)
static

◆ pythiaInit() [1/2]

void EvtPythia::pythiaInit ( int  f)
static

Definition at line 1051 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtPythia.cc.

1051 {
1052
1053 static int first=1;
1054 if (first){
1055
1056 first=0;
1057
1058 report(INFO,"EvtGen") << "Will initialize Pythia."<<endl;
1059 for(int i=0;i<ncommand;i++)
1060 pygive_(commands[i].c_str(),strlen(commands[i].c_str()));
1061
1062 char fname[200];
1063
1064 char hostBuffer[100];
1065
1066 if ( gethostname( hostBuffer, 100 ) != 0 ){
1067 report(ERROR,"EvtGen") << " couldn't get hostname." << endl;
1068 strncpy( hostBuffer, "hostnameNotFound", 100 );
1069 }
1070
1071 char pid[100];
1072
1073 int thePid=getpid();
1074
1075 if ( sprintf( pid, "%d", thePid ) == 0 ){
1076 report(ERROR,"EvtGen") << " couldn't get process ID." << endl;
1077 strncpy( pid, "666", 100 );
1078 }
1079
1080 strcpy(fname,"jet.d-");
1081 strcat(fname,hostBuffer);
1082 strcat(fname,"-");
1083 strcat(fname,pid);
1084
1085 MakePythiaFile(fname);
1086 evtpythiainit_(fname,strlen(fname));
1087 initpythia_(&dummy);
1088
1089 if (0==getenv("EVTSAVEJETD")){
1090 char delcmd[300];
1091 strcpy(delcmd,"rm -f ");
1092 strcat(delcmd,fname);
1093 system(delcmd);
1094 }
1095
1096 report(INFO,"EvtGen") << "Done initializing Pythia."<<endl;
1097
1098 }
1099
1100}
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)

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

◆ pythiaInit() [2/2]

static void EvtPythia::pythiaInit ( int  f)
static

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