BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtLunda Class Reference

#include <EvtLunda.hh>

+ Inheritance diagram for EvtLunda:

Public Member Functions

 EvtLunda ()
 
virtual ~EvtLunda ()
 
void getName (std::string &name)
 
EvtDecayBaseclone ()
 
void decay (EvtParticle *p)
 
std::string commandName ()
 
void command (std::string cmd)
 
void init ()
 
void initProbMax ()
 
int getTotalEvt ()
 
void LundaInit (int dummy)
 
void ExclusiveDecay (EvtParticle *p)
 
- 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 ()
 

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from EvtDecayBase
bool daugsDecayedByParentModel ()
 
- Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel
 

Detailed Description

Definition at line 33 of file EvtLunda.hh.

Constructor & Destructor Documentation

◆ EvtLunda()

EvtLunda::EvtLunda ( )

Definition at line 90 of file EvtLunda.cc.

90{}

Referenced by clone().

◆ ~EvtLunda()

EvtLunda::~EvtLunda ( )
virtual

Definition at line 91 of file EvtLunda.cc.

91 {
92
93
94 int i;
95
96
97 //the deletion of commands is really uggly!
98
99 if (nlundadecays==0) {
100 delete [] commands;
101 commands=0;
102 return;
103 }
104
105 for(i=0;i<nlundadecays;i++){
106 if (lundadecays[i]==this){
107 lundadecays[i]=lundadecays[nlundadecays-1];
108 nlundadecays--;
109 if (nlundadecays==0) {
110 delete [] commands;
111 commands=0;
112 }
113 return;
114 }
115 }
116
117 report(ERROR,"EvtGen") << "Error in destroying Lunda model!"<<endl;
118
119}
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtLunda::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 128 of file EvtLunda.cc.

128 {
129
130 return new EvtLunda;
131
132}
EvtLunda()
Definition: EvtLunda.cc:90

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 176 of file EvtLunda.cc.

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

◆ commandName()

std::string EvtLunda::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 170 of file EvtLunda.cc.

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

◆ decay()

void EvtLunda::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 204 of file EvtLunda.cc.

204 {
205
206 static int iniflag=1;
207
208 static EvtId STRNG=EvtPDL::getId("string");
209
210 int istdheppar=EvtPDL::getStdHep(p->getId());
211
212 /*
213 int Xpdg=0;
214 if(getNArg()==1){
215 Xpdg = getArg(0);
216 if(Xpdg == 100443) Xpdg = 30443; //chage the curent pdg code to jetset pdg code for psiprime
217 }
218 nores_.xpdg = Xpdg;
219 */
220
221/*
222 if (pycomp_(&istdheppar)==0){
223 report(ERROR,"EvtGen") << "Lunda can not decay:"
224 <<EvtPDL::name(p->getId()).c_str()<<endl;
225 return;
226 }
227*/
228 double mp=p->mass();
229 float xmp=mp;
230// std::cout<<"float xmp="<<xmp<<std::endl;
231
232 EvtVector4R p4[20];
233
234 int i,more;
235 int ip=EvtPDL::getStdHep(p->getId());
236 int ndaugjs;
237 static int kf[4000];
238 EvtId evtnumstable[100],evtnumparton[100];
239 int stableindex[100],partonindex[100];
240 int numstable;
241 int numparton;
242 static int km[4000];
243 EvtId type[MAX_DAUG];
244
245 int isr=1; //open ISR (default)
246 if(getNArg()>0){ isr=getArg(0);}
247
248 static double px[4000],py[4000],pz[4000],e[4000];
249 if (iniflag==1) lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
250
251 if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
252
253 int count=0;
254 bool mtg=0;
255
256 do{
257 //report(INFO,"EvtGen") << "calling lunda " << ip<< " " << mp <<endl;
258 iniflag=iniflag+1; //to count the event number
259 //std::cout<<"Event number by Lunda: "<<iniflag<<std::endl;
260modeSelection:
261 lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
262
263 mtg = checktag_.decaytag==1;
264 if(mtg)std::cout<<"checktag_.decaytag="<<checktag_.decaytag<<std::endl;
265 //if the Ecms is too low, Lunda fails to decay, so change to 3pi decay exclusively
266 //if(mtg) {ExclusiveDecay(p); return;} //see SUBROUTINE LUBEGN(KFL,ECM) in luarlw.F
267
268 LundaInit(0); // allow user to set LundaPar in the decay list
269 numstable=0;
270 numparton=0;
271 //report(INFO,"EvtGen") << "found some daughters " << ndaugjs << endl;
272 double esum=0;
273 //for debugging
274 //for(int i=0;i<ndaugjs;i++){
275 //std::cout<<"ndaugjs,kf,km,px,py,pz,e: "<<i<<", "<<km[i]<<", "<<EvtPDL::name(EvtPDL::evtIdFromStdHep(kf[i]))<<", "<<px[i]<<" ,"<<py[i]<<", "<<pz[i]<<", "<<e[i]<<std::endl;
276 //}
277
278 for(i=0;i<ndaugjs;i++){
279 if (abs(kf[i])==11 || kf[i]==92 || kf[i]==22) continue; //fill out the unstatble particle
280 //std::cout<<i<<", "<<km[i]<<", "<<kf[i]<<", "<<EvtPDL::name(EvtPDL::evtIdFromStdHep(kf[i]))<<" "<<px[i]<<" ,"<<py[i]<<", "<<pz[i]<<", "<<e[i]<<std::endl; //for debugging
281 if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
282 report(ERROR,"EvtGen") << "Lunda returned particle:"<<kf[i]<<endl;
283 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
284 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
285 report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
286 //xmp=(1+0.01)*xmp;
287 std::cout<<"xmp= "<<xmp<<std::endl;
288 goto modeSelection;
289 }
290
291 //sort out the partons
292 if (abs(kf[i])<=6||kf[i]==21){
293 partonindex[numparton]=i;
294 evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
295 numparton++;
296 }
297 else{
298 stableindex[numstable]=i;
299 evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]);
300 numstable++;
301 }
302
303 esum+=e[i];
304 // have to protect against negative mass^2 for massless particles
305 // i.e. neutrinos and photons.
306 // this is uggly but I need to fix it right now....
307
308 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
309
310 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
311
312 }
313
314 p4[i].set(e[i],px[i],py[i],pz[i]);
315
316
317 }
318
319 int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
320
321 // Test the branching fraction of lunda
322 // the specified decay mode is put as the 0-th channel with specifing mother particle
323 more=(channel!=-1);
324 //debugging
325 if(abs(esum-xmp)>0.001 ){
326 std::cout<<"Unexpected final states from Lunda with total energy "<<esum<<" unequal to "<<xmp<<std::endl;
327 //xmp=(1+0.01)*xmp;
328 std::cout<<"xmp= "<<xmp<<std::endl;
329 goto modeSelection;
330 }
331
332 count++;
333 }while( more && (count<10000) && mtg );
334 // }while( more && (count<10000) );
335
336 if (count>9999) {
337 report(INFO,"EvtGen") << "Too many loops in EvtLunda!!!"<<endl;
338 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
339 for(i=0;i<numstable;i++){
340 report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
341 }
342
343 }
344
345
346
347 if (numparton==0){
348
349 p->makeDaughters(numstable,evtnumstable);
350 int ndaugFound=0;
351 for(i=0;i<numstable;i++){
352 p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
353 ndaugFound++;
354 }
355 if ( ndaugFound == 0 ) {
356 report(ERROR,"EvtGen") << "Lunda has failed to do a decay ";
357 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass()<<endl;
358 assert(0);
359 }
360
361 fixPolarizations(p);
362 //debugging
363 // p->printTree();
364
365 return ;
366
367 }
368 else{
369
370 //have partons in LUNDA
371
372 EvtVector4R p4string(0.0,0.0,0.0,0.0);
373
374 for(i=0;i<numparton;i++){
375 p4string+=p4[partonindex[i]];
376 }
377
378 int nprimary=1;
379 type[0]=STRNG;
380 for(i=0;i<numstable;i++){
381 if (km[stableindex[i]]==0){
382 type[nprimary++]=evtnumstable[i];
383 }
384 }
385
386 p->makeDaughters(nprimary,type);
387
388 p->getDaug(0)->init(STRNG,p4string);
389
390 EvtVector4R p4partons[10];
391
392 for(i=0;i<numparton;i++){
393 p4partons[i]=p4[partonindex[i]];
394 }
395
396 ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
397
398
399
400 nprimary=1;
401
402 for(i=0;i<numstable;i++){
403
404 if (km[stableindex[i]]==0){
405 p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
406 }
407 }
408
409
410 int nsecond=0;
411 for(i=0;i<numstable;i++){
412 if (km[stableindex[i]]!=0){
413 type[nsecond++]=evtnumstable[i];
414 }
415 }
416
417
418 p->getDaug(0)->makeDaughters(nsecond,type);
419
420 EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
421 -p4string.get(2),-p4string.get(3));
422
423 nsecond=0;
424 for(i=0;i<numstable;i++){
425 if (km[stableindex[i]]!=0){
426 p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4stringboost);
427 p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
428 p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
429 p->getDaug(0)->getDaug(nsecond)->decay();
430 nsecond++;
431 }
432 }
433
434 if ( nsecond == 0 ) {
435 report(ERROR,"EvtGen") << "Jetset has failed to do a decay ";
436 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass() <<endl;
437 assert(0);
438 }
439
440 fixPolarizations(p);
441
442 return ;
443
444 }
445
446}
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void lundar_(int *, int *, float *, int *, int *, int *, double *, double *, double *, double *)
struct @9 checktag_
const int MAX_DAUG
Definition: EvtParticle.hh:38
DOUBLE_PRECISION count[2]
@ INFO
Definition: EvtReport.hh:52
double getArg(int j)
EvtId getParentId()
Definition: EvtDecayBase.hh:60
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
Definition: EvtId.hh:27
void LundaInit(int dummy)
Definition: EvtLunda.cc:511
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:540
double mass() const
Definition: EvtParticle.cc:127
void set(int i, double d)
Definition: EvtVector4R.hh:183
const double mp
Definition: incllambda.cxx:45

◆ ExclusiveDecay()

void EvtLunda::ExclusiveDecay ( EvtParticle p)

Definition at line 523 of file EvtLunda.cc.

523 {
524 EvtId daugs[8];
525 int _ndaugs =4;
526 daugs[0]=EvtPDL::getId(std::string("pi+"));
527 daugs[1]=EvtPDL::getId(std::string("pi-"));
528 daugs[2]=EvtPDL::getId(std::string("pi+"));
529 daugs[3]=EvtPDL::getId(std::string("pi-"));
530 checkA:
531 p->makeDaughters(_ndaugs,daugs);
532 double totMass=0;
533 for(int i=0;i< _ndaugs;i++){
534 EvtParticle* di=p->getDaug(i);
535 double xmi=EvtPDL::getMass(di->getId());
536 di->setMass(xmi);
537 totMass+=xmi;
538 }
539 if(totMass>p->mass()) goto checkA;
540 p->initializePhaseSpace( _ndaugs , daugs);
541
542
543}
static double getMass(EvtId i)
Definition: EvtPDL.hh:46
void setMass(double m)
Definition: EvtParticle.hh:372
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)

◆ getName()

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

Implements EvtDecayBase.

Definition at line 122 of file EvtLunda.cc.

122 {
123
124 model_name="LUNDA";
125
126}

◆ getTotalEvt()

int EvtLunda::getTotalEvt ( )
inline

Definition at line 50 of file EvtLunda.hh.

50{return nevt;}

◆ init()

void EvtLunda::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 142 of file EvtLunda.cc.

142 {
143
144// checkNArg(1);
145 std::string strpdg=getenv("BESEVTGENROOT");
146 strpdg +="/share/r_pdg.dat";
147 //strcpy(mypdgfile_.mypdg, strpdg.c_str());
148 std::cout<<"mypdg= "<<strpdg<<std::endl;
149
150 if(getNArg()>2){std::cout<<"Parameter can be 1 or 2, You have "<<getNArg()<<std::endl; ::abort();}
151
152 if (getParentId().isAlias()){
153
154 report(ERROR,"EvtGen") << "EvtLunda finds that you are decaying the"<<endl
155 << " aliased particle "
156 << EvtPDL::name(getParentId()).c_str()
157 << " with the Lunda 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}

◆ initProbMax()

void EvtLunda::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 135 of file EvtLunda.cc.

135 {
136
137 noProbMax();
138
139}
void noProbMax()

◆ LundaInit()

void EvtLunda::LundaInit ( int  dummy)

Definition at line 511 of file EvtLunda.cc.

511 {
512
513 static int first=1;
514 if (first){
515
516 first=0;
517 for(int i=0;i<ncommand;i++)
518 lugive0_(commands[i].c_str(),strlen(commands[i].c_str()));
519 }
520
521}
void lugive0_(const char *cnfgstr, int length)
char * c_str(Index i)
Definition: EvtCyclic3.cc:252
Index first(Pair i)
Definition: EvtCyclic3.cc:195

Referenced by decay().


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