BOSS 8.0.0
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
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 87 of file EvtLunda.cc.

87{}

Referenced by clone().

◆ ~EvtLunda()

EvtLunda::~EvtLunda ( )
virtual

Definition at line 88 of file EvtLunda.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtLunda::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 121 of file EvtLunda.cc.

121{ return new EvtLunda; }

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 155 of file EvtLunda.cc.

155 {
156 if ( ncommand == lcommand )
157 {
158 lcommand = 10 + 2 * lcommand;
159 std::string* newcommands = new std::string[lcommand];
160 int i;
161 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
162 delete[] commands;
163 commands = newcommands;
164 }
165 commands[ncommand] = cmd;
166 ncommand++;
167}

◆ commandName()

std::string EvtLunda::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 153 of file EvtLunda.cc.

153{ return std::string( "LundaPar" ); }

◆ decay()

void EvtLunda::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 169 of file EvtLunda.cc.

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

◆ ExclusiveDecay()

void EvtLunda::ExclusiveDecay ( EvtParticle * p)

Definition at line 485 of file EvtLunda.cc.

485 {
486 EvtId daugs[8];
487 int _ndaugs = 4;
488 daugs[0] = EvtPDL::getId( std::string( "pi+" ) );
489 daugs[1] = EvtPDL::getId( std::string( "pi-" ) );
490 daugs[2] = EvtPDL::getId( std::string( "pi+" ) );
491 daugs[3] = EvtPDL::getId( std::string( "pi-" ) );
492checkA:
493 p->makeDaughters( _ndaugs, daugs );
494 double totMass = 0;
495 for ( int i = 0; i < _ndaugs; i++ )
496 {
497 EvtParticle* di = p->getDaug( i );
498 double xmi = EvtPDL::getMass( di->getId() );
499 di->setMass( xmi );
500 totMass += xmi;
501 }
502 if ( totMass > p->mass() ) goto checkA;
503 p->initializePhaseSpace( _ndaugs, daugs );
504}
static double getMass(EvtId i)
Definition EvtPDL.hh:44
void setMass(double m)
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 119 of file EvtLunda.cc.

119{ model_name = "LUNDA"; }

◆ getTotalEvt()

int EvtLunda::getTotalEvt ( )
inline

Definition at line 49 of file EvtLunda.hh.

49{ return nevt; }

◆ init()

void EvtLunda::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 125 of file EvtLunda.cc.

125 {
126
127 // checkNArg(1);
128 std::string strpdg = getenv( "BESEVTGENROOT" );
129 strpdg += "/share/r_pdg.dat";
130 // strcpy(mypdgfile_.mypdg, strpdg.c_str());
131 std::cout << "mypdg= " << strpdg << std::endl;
132
133 if ( getNArg() > 2 )
134 {
135 std::cout << "Parameter can be 1 or 2, You have " << getNArg() << std::endl;
136 ::abort();
137 }
138
139 if ( getParentId().isAlias() )
140 {
141
142 report( ERROR, "EvtGen" ) << "EvtLunda finds that you are decaying the" << endl
143 << " aliased particle " << EvtPDL::name( getParentId() ).c_str()
144 << " with the Lunda model" << endl
145 << " this does not work, please modify decay table." << endl;
146 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
147 ::abort();
148 }
149
150 store( this );
151}

◆ initProbMax()

void EvtLunda::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 123 of file EvtLunda.cc.

123{ noProbMax(); }

◆ LundaInit()

void EvtLunda::LundaInit ( int dummy)

Definition at line 473 of file EvtLunda.cc.

473 {
474
475 static int first = 1;
476 if ( first )
477 {
478
479 first = 0;
480 for ( int i = 0; i < ncommand; i++ )
481 lugive0_( commands[i].c_str(), strlen( commands[i].c_str() ) );
482 }
483}
void lugive0_(const char *cnfgstr, int length)
char * c_str(Index i)
Index first(Pair i)

Referenced by decay().


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