CGEM BOSS 6.6.5.f
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
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 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 33 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
96 int i;
97
98
99 //the deletion of commands is really uggly!
100
101 if (njetsetdecays==0) {
102 delete [] commands;
103 commands=0;
104 return;
105 }
106
107 for(i=0;i<njetsetdecays;i++){
108 if (jetsetdecays[i]==this){
109 jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
110 njetsetdecays--;
111 if (njetsetdecays==0) {
112 delete [] commands;
113 commands=0;
114 }
115 return;
116 }
117 }
118
119 report(ERROR,"EvtGen") << "Error in destroying Pythia model!"<<endl;
120
121}
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtPythia::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 130 of file EvtPythia.cc.

130 {
131
132 return new EvtPythia;
133
134}

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 174 of file EvtPythia.cc.

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

◆ commandName()

std::string EvtPythia::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 167 of file EvtPythia.cc.

167 {
168
169 return std::string("JetSetPar");
170
171}

◆ decay()

void EvtPythia::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 208 of file EvtPythia.cc.

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

◆ getName()

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

Implements EvtDecayBase.

Definition at line 124 of file EvtPythia.cc.

124 {
125
126 model_name="PYTHIA";
127
128}

◆ init()

void EvtPythia::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 144 of file EvtPythia.cc.

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

◆ initProbMax()

void EvtPythia::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 137 of file EvtPythia.cc.

137 {
138
139 noProbMax();
140
141}
void noProbMax()

◆ pythiacont()

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

Definition at line 200 of file EvtPythia.cc.

202{
203 pycontinuum_(energy,ndaugjs,kf,px,py,pz,e);
204}
void pycontinuum_(double *, int *, int *, double *, double *, double *, double *)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot 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 1046 of file EvtPythia.cc.

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

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


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