BOSS 6.6.4.p03
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)
 
- 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 85 of file EvtLunda.cc.

85{}

Referenced by clone().

◆ ~EvtLunda()

EvtLunda::~EvtLunda ( )
virtual

Definition at line 86 of file EvtLunda.cc.

86 {
87
88
89 int i;
90
91
92 //the deletion of commands is really uggly!
93
94 if (nlundadecays==0) {
95 delete [] commands;
96 commands=0;
97 return;
98 }
99
100 for(i=0;i<nlundadecays;i++){
101 if (lundadecays[i]==this){
102 lundadecays[i]=lundadecays[nlundadecays-1];
103 nlundadecays--;
104 if (nlundadecays==0) {
105 delete [] commands;
106 commands=0;
107 }
108 return;
109 }
110 }
111
112 report(ERROR,"EvtGen") << "Error in destroying Lunda model!"<<endl;
113
114}
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 123 of file EvtLunda.cc.

123 {
124
125 return new EvtLunda;
126
127}
EvtLunda()
Definition: EvtLunda.cc:85

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 171 of file EvtLunda.cc.

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

◆ commandName()

std::string EvtLunda::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 165 of file EvtLunda.cc.

165 {
166
167 return std::string("LundaPar");
168
169}

◆ decay()

void EvtLunda::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 199 of file EvtLunda.cc.

199 {
200
201 static int iniflag=0;
202
203 static EvtId STRNG=EvtPDL::getId("string");
204
205 int istdheppar=EvtPDL::getStdHep(p->getId());
206
207 /*
208 int Xpdg=0;
209 if(getNArg()==1){
210 Xpdg = getArg(0);
211 if(Xpdg == 100443) Xpdg = 30443; //chage the curent pdg code to jetset pdg code for psiprime
212 }
213 nores_.xpdg = Xpdg;
214 */
215
216/*
217 if (pycomp_(&istdheppar)==0){
218 report(ERROR,"EvtGen") << "Lunda can not decay:"
219 <<EvtPDL::name(p->getId()).c_str()<<endl;
220 return;
221 }
222*/
223 double mp=p->mass();
224 float xmp=mp;
225// std::cout<<"float xmp="<<xmp<<std::endl;
226
227 EvtVector4R p4[20];
228
229 int i,more;
230 int ip=EvtPDL::getStdHep(p->getId());
231 int ndaugjs;
232 static int kf[100];
233 EvtId evtnumstable[100],evtnumparton[100];
234 int stableindex[100],partonindex[100];
235 int numstable;
236 int numparton;
237 static int km[100];
238 EvtId type[MAX_DAUG];
239
240 int isr=1; //open ISR (default)
241 if(getNArg()>0){ isr=getArg(0);}
242
243 static double px[100],py[100],pz[100],e[100];
244 if (iniflag==0) lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
245
246 if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
247
248 int count=0;
249
250 do{
251 //report(INFO,"EvtGen") << "calling lunda " << ip<< " " << mp <<endl;
252 iniflag=iniflag+1; //to count the event number
253 lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
254 LundaInit(0); // allow user to set LundaPar in the decay list
255 numstable=0;
256 numparton=0;
257 //report(INFO,"EvtGen") << "found some daughters " << ndaugjs << endl;
258 for(i=0;i<ndaugjs;i++){
259 // std::cout<<"ndaugjs,kf,km,px,py,pz,e: "<<i<<", "<<km[i]<<", "<<kf[i]<<", "<<px[i]<<" ,"<<py[i]<<", "<<pz[i]<<", "<<e[i]<<std::endl; //for debugging
260
261 if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
262 report(ERROR,"EvtGen") << "Lunda returned particle:"<<kf[i]<<endl;
263 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
264 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
265 report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
266
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.0000000001;
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 // Test the branching fraction of lunda
300 // the specified decay mode is put as the 0-th channel with specifing mother particle
301 /*
302 if(ip==100443 && channel==0){
303 nevt++;
304 std::cout<<"nevt= "<<nevt<<std::endl;
305 channel=-1;
306 }
307 */
308 // std::cout<<"channel= "<<channel<<std::endl;
309 more=(channel!=-1);
310
311
312
313
314 count++;
315
316 }while( more && (count<10000) );
317
318 if (count>9999) {
319 report(INFO,"EvtGen") << "Too many loops in EvtLunda!!!"<<endl;
320 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
321 for(i=0;i<numstable;i++){
322 report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
323 }
324
325 }
326
327
328
329 if (numparton==0){
330
331 p->makeDaughters(numstable,evtnumstable);
332 int ndaugFound=0;
333 for(i=0;i<numstable;i++){
334 p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
335 ndaugFound++;
336 }
337 if ( ndaugFound == 0 ) {
338 report(ERROR,"EvtGen") << "Lunda has failed to do a decay ";
339 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass()<<endl;
340 assert(0);
341 }
342
343 fixPolarizations(p);
344
345 return ;
346
347 }
348 else{
349
350 //have partons in LUNDA
351
352 EvtVector4R p4string(0.0,0.0,0.0,0.0);
353
354 for(i=0;i<numparton;i++){
355 p4string+=p4[partonindex[i]];
356 }
357
358 int nprimary=1;
359 type[0]=STRNG;
360 for(i=0;i<numstable;i++){
361 if (km[stableindex[i]]==0){
362 type[nprimary++]=evtnumstable[i];
363 }
364 }
365
366 p->makeDaughters(nprimary,type);
367
368 p->getDaug(0)->init(STRNG,p4string);
369
370 EvtVector4R p4partons[10];
371
372 for(i=0;i<numparton;i++){
373 p4partons[i]=p4[partonindex[i]];
374 }
375
376 ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
377
378
379
380 nprimary=1;
381
382 for(i=0;i<numstable;i++){
383
384 if (km[stableindex[i]]==0){
385 p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
386 }
387 }
388
389
390 int nsecond=0;
391 for(i=0;i<numstable;i++){
392 if (km[stableindex[i]]!=0){
393 type[nsecond++]=evtnumstable[i];
394 }
395 }
396
397
398 p->getDaug(0)->makeDaughters(nsecond,type);
399
400 EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
401 -p4string.get(2),-p4string.get(3));
402
403 nsecond=0;
404 for(i=0;i<numstable;i++){
405 if (km[stableindex[i]]!=0){
406 p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4stringboost);
407 p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
408 p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
409 p->getDaug(0)->getDaug(nsecond)->decay();
410 nsecond++;
411 }
412 }
413
414 if ( nsecond == 0 ) {
415 report(ERROR,"EvtGen") << "Jetset has failed to do a decay ";
416 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass() <<endl;
417 assert(0);
418 }
419
420 fixPolarizations(p);
421
422 return ;
423
424 }
425
426}
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void lundar_(int *, int *, float *, int *, int *, int *, double *, double *, double *, double *)
const int MAX_DAUG
Definition: EvtParticle.hh:38
@ 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:491
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
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 EvtLunda::getName ( std::string &  name)
virtual

Implements EvtDecayBase.

Definition at line 117 of file EvtLunda.cc.

117 {
118
119 model_name="LUNDA";
120
121}

◆ 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 137 of file EvtLunda.cc.

137 {
138
139// checkNArg(1);
140 std::string strpdg=getenv("BESEVTGENROOT");
141 strpdg +="/share/r_pdg.dat";
142 //strcpy(mypdgfile_.mypdg, strpdg.c_str());
143 std::cout<<"mypdg= "<<strpdg<<std::endl;
144
145 if(getNArg()>2){std::cout<<"Parameter can be 1 or 2, You have "<<getNArg()<<std::endl; ::abort();}
146
147 if (getParentId().isAlias()){
148
149 report(ERROR,"EvtGen") << "EvtLunda finds that you are decaying the"<<endl
150 << " aliased particle "
151 << EvtPDL::name(getParentId()).c_str()
152 << " with the Lunda model"<<endl
153 << " this does not work, please modify decay table."
154 << endl;
155 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
156 ::abort();
157
158 }
159
160 store(this);
161
162}

◆ initProbMax()

void EvtLunda::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 130 of file EvtLunda.cc.

130 {
131
132 noProbMax();
133
134}
void noProbMax()

◆ LundaInit()

void EvtLunda::LundaInit ( int  dummy)

Definition at line 491 of file EvtLunda.cc.

491 {
492
493 static int first=1;
494 if (first){
495
496 first=0;
497 for(int i=0;i<ncommand;i++)
498 lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
499 }
500
501}
void lugive_(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: