46 for ( i = 0; i < _ndaug; i++ ) {
q +=
EvtPDL::chg3( _daug[i] ); }
51 report(
ERROR,
"EvtGen" ) << _modelname.c_str() <<
" generator expected "
52 <<
" charge to be conserved, found:" << endl;
53 report(
ERROR,
"EvtGen" ) <<
"Parent charge of " << ( qpar / 3 ) << endl;
54 report(
ERROR,
"EvtGen" ) <<
"Sum of daughter charge of " << (
q / 3 ) << endl;
56 for ( i = 0; i < _ndaug; i++ )
58 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
71 if ( prob > max_prob ) max_prob = prob;
73 if ( defaultprobmax && ntimes_prob <= 500 )
77 if ( prob > probmax ) { probmax = prob; }
78 if ( ntimes_prob == 500 ) { probmax *= 1.2; }
79 return 1000000.0 * prob;
82 if ( prob > probmax * 1.0001 )
85 report(
INFO,
"EvtGen" ) <<
"prob > probmax:(" << prob <<
">" << probmax <<
")";
86 report(
INFO,
"" ) <<
"(" << _modelname.c_str() <<
") ";
88 for ( i = 0; i < _ndaug; i++ )
92 if ( defaultprobmax ) probmax = prob;
103 report(
INFO,
"EvtGen" ) <<
"Reseting prob max\n";
104 report(
INFO,
"EvtGen" ) <<
"prob > probmax:(" << prob <<
">" << probmax <<
")";
105 report(
INFO,
"" ) <<
"(" << _modelname.c_str() <<
")";
108 for (
int i = 0; i < _ndaug; i++ )
121 report(
ERROR,
"EvtGen" ) <<
"Should never call EvtDecayBase::command" << endl;
152 std::vector<std::string>& args, std::string name,
166 _daug =
new EvtId[_ndaug];
167 for ( i = 0; i < _ndaug; i++ )
177 _args =
new std::string[_narg + 1];
178 for ( i = 0; i < _narg; i++ ) { _args[i] = args[i]; }
187 if ( _chkCharge ) { this->
checkQ(); }
189 if ( defaultprobmax )
191 report(
INFO,
"EvtGen" ) <<
"No default probmax for ";
192 report(
INFO,
"" ) <<
"(" << _modelname.c_str() <<
") ";
194 for ( i = 0; i < _ndaug; i++ )
197 report(
INFO,
"" ) <<
"This is fine for development, but must be provided for production."
199 report(
INFO,
"EvtGen" ) <<
"Never fear though - the decay will use the \n";
200 report(
INFO,
"EvtGen" ) <<
"500 iterations to build up a good probmax \n";
201 report(
INFO,
"EvtGen" ) <<
"before accepting a decay. " << endl;
216 _parent =
EvtId( -1, -1 );
222 _modelname =
"**********";
237 if ( ntimes_prob > 0 )
240 report(
INFO,
"EvtGen" ) <<
"Calls=" << ntimes_prob
241 <<
" eff:" << sum_prob / ( probmax * ntimes_prob )
242 <<
" frac. max:" << max_prob / probmax;
243 report(
INFO,
"" ) <<
" probmax:" << probmax <<
" max:" << max_prob <<
" : ";
247 for ( i = 0; i < _ndaug; i++ )
249 report(
INFO,
"" ) <<
" (" << _modelname.c_str() <<
"):" << endl;
254 if ( _daug != 0 ) {
delete[] _daug; }
256 if ( _args != 0 ) {
delete[] _args; }
258 if ( _argsD != 0 ) {
delete[] _argsD; }
274 if ( maxOkMass < 0.0000000001 )
return 10000000.;
283 double minDaugMass = 0.;
284 for ( i = 0; i < par->
getNDaug(); i++ )
296 if ( maxOkMass > ( maxParMass - minDaugMass ) ) maxOkMass = maxParMass - minDaugMass;
321 report(
INFO,
"EvtGen" ) <<
"Can not find a valid mass for: "
323 report(
INFO,
"EvtGen" ) <<
"Now printing parent and/or grandparent tree\n";
339 report(
INFO,
"EvtGen" ) <<
"maxokmass=" << maxOkMass <<
" "
344 for ( i = 0; i < p->
getNDaug(); i++ )
350 report(
INFO,
"EvtGen" ) <<
"taking a default value\n";
365 if ( p->
getNDaug() < 2 ) massOk =
true;
372 if ( massSum <
mass ) massOk =
true;
373 if (
mass > maxOkMass ) massOk =
false;
381 double masses[10] ) {
390 for ( i = 0; i < ndaugs; i++ ) { masses[i] = p->
getDaug( i )->
mass(); }
399 masses[0] = p->
mass();
407 for ( i = 0; i < ndaugs; i++ )
410 mass_sum = mass_sum + masses[i];
415 if (
count == 10000 )
418 <<
" (m=" << p->
mass() <<
")" << endl;
419 report(
ERROR,
"EvtGen" ) <<
"To the following daugthers" << endl;
420 for ( i = 0; i < ndaugs; i++ )
423 <<
"Has been rejected " <<
count <<
" times, will now take minimal masses "
424 <<
" of daugthers" << endl;
427 for ( i = 0; i < ndaugs; i++ )
430 mass_sum = mass_sum + masses[i];
432 if ( mass_sum > p->
mass() )
435 <<
"Parent mass=" << p->
mass() <<
"to light for daugthers." << endl
436 <<
"Will throw the event away." << endl;
443 }
while ( mass_sum > p->
mass() );
451 if ( _narg != a1 && _narg != a2 && _narg != a3 && _narg != a4 )
453 report(
ERROR,
"EvtGen" ) << _modelname.c_str() <<
" generator expected " << endl;
456 if ( a2 > -1 ) {
report(
ERROR,
"EvtGen" ) <<
" or " << a2 << endl; }
457 if ( a3 > -1 ) {
report(
ERROR,
"EvtGen" ) <<
" or " << a3 << endl; }
458 if ( a4 > -1 ) {
report(
ERROR,
"EvtGen" ) <<
" or " << a4 << endl; }
459 report(
ERROR,
"EvtGen" ) <<
" arguments but found:" << _narg << endl;
461 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
467 if ( _ndaug != d1 && _ndaug != d2 )
469 report(
ERROR,
"EvtGen" ) << _modelname.c_str() <<
" generator expected ";
471 if ( d2 > -1 ) {
report(
ERROR,
"EvtGen" ) <<
" or " << d2; }
472 report(
ERROR,
"EvtGen" ) <<
" daughters but found:" << _ndaug << endl;
474 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
482 if ( parenttype != sp )
485 <<
" did not get the correct parent spin\n";
487 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
495 if ( parenttype != sp )
498 <<
" did not get the correct daughter spin d=" << d1 << endl;
500 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
507 if ( _argsD )
return _argsD;
510 if ( _narg == 0 )
return _argsD;
512 _argsD =
new double[_narg];
516 for ( i = 0; i < _narg; i++ ) { _argsD[i] = strtod( _args[i].c_str(), &tc ); }
524 const char* str = _args[j].c_str();
526 while ( str[i] != 0 )
528 if ( isalpha( str[i] ) && str[i] !=
'e' )
531 report(
INFO,
"EvtGen" ) <<
"String " << str <<
" is not a number" << endl;
538 return strtod( _args[j].c_str(), tc );
543 if ( _ndaug != other._ndaug )
return false;
544 if ( _parent != other._parent )
return false;
546 std::vector<int> useDs;
547 for (
unsigned int i = 0; i < _ndaug; i++ ) useDs.push_back( 0 );
549 for (
unsigned int i = 0; i < _ndaug; i++ )
551 bool foundIt =
false;
552 for (
unsigned int j = 0; j < _ndaug; j++ )
554 if ( useDs[j] == 1 )
continue;
555 if ( _daug[i] == other._daug[j] && _daug[i].getAlias() == other._daug[j].getAlias() )
562 if ( foundIt ==
false )
return false;
564 for (
unsigned int i = 0; i < _ndaug; i++ )
565 if ( useDs[i] == 0 )
return false;
DOUBLE_PRECISION count[3]
ostream & report(Severity severity, const char *facility)
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
void checkSpinDaughter(int d1, EvtSpinType::spintype sp)
void checkSpinParent(EvtSpinType::spintype sp)
double resetProbMax(double prob)
void setProbMax(double prbmx)
static void findMass(EvtParticle *p)
virtual bool matchingDecay(const EvtDecayBase &other) const
static double findMaxMass(EvtParticle *p)
void saveDecayInfo(EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
virtual void command(std::string cmd)
double getProbMax(double prob)
static void findMasses(EvtParticle *p, int ndaugs, EvtId daugs[10], double masses[10])
void checkNDaug(int d1, int d2=-1)
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
virtual void initProbMax()
virtual std::string commandName()
static int getStdHep(EvtId id)
static std::string name(EvtId i)
static double getMinMass(EvtId i)
static EvtSpinType::spintype getSpinType(EvtId i)
static double getMaxMass(EvtId i)
static double getMass(EvtId i)
EvtParticle * getParent()
EvtParticle * getDaug(int i)
static void setRejectFlag()