93 node->_daug[node->_ndaug++] =
this;
122 report(
ERROR,
"EvtGen" ) <<
"Error in EvtParticle::setVectorSpinDensity" << endl;
140 report(
ERROR,
"EvtGen" ) <<
"Error in EvtParticle::setVectorSpinDensity" << endl;
160 assert( R.GetDim() == rho.
GetDim() );
164 _rhoForward.SetDim(
n );
168 for ( i = 0; i <
n; i++ )
170 for ( j = 0; j <
n; j++ )
173 for ( k = 0; k <
n; k++ )
175 for ( l = 0; l <
n; l++ )
176 { tmp += R.Get( l, i ) * rho.
Get( l, k ) *
conj( R.Get( k, j ) ); }
178 _rhoForward.Set( i, j, tmp );
186 double beta,
double gamma ) {
190 assert( R.GetDim() == rho.
GetDim() );
194 _rhoForward.SetDim(
n );
198 for ( i = 0; i <
n; i++ )
200 for ( j = 0; j <
n; j++ )
203 for ( k = 0; k <
n; k++ )
205 for ( l = 0; l <
n; l++ )
206 { tmp += R.Get( l, i ) * rho.
Get( l, k ) *
conj( R.Get( k, j ) ); }
208 _rhoForward.Set( i, j, tmp );
220 double parMass = -1.;
225 for ( i = 0; i < par->
getNDaug(); i++ )
238 for ( ii = 0; ii < _ndaug; ii++ )
248 double* dauMasses = 0;
251 dauId =
new EvtId[_ndaug];
252 dauMasses =
new double[_ndaug];
253 for ( j = 0; j < _ndaug; j++ )
267 if ( tempPar->
getDaug( 0 ) ==
this )
279 if ( parId )
delete parId;
280 if ( othDauId )
delete othDauId;
281 if ( dauId )
delete[] dauId;
282 if ( dauMasses )
delete[] dauMasses;
308 if (
getId() == BS0 )
311 scalar_part->
init( BSB, p_init );
313 else if (
getId() == BSB )
316 scalar_part->
init( BS0, p_init );
318 else if (
getId() == BD0 )
321 scalar_part->
init( BDB, p_init );
323 else if (
getId() == BDB )
326 scalar_part->
init( BD0, p_init );
342 if ( _ndaug == 1 ) std::cout <<
"hi " <<
EvtPDL::name( this->
getId() ) << std::endl;
353 for ( i = 0; i < p->
getNDaug(); i++ )
367 double* dauMasses = 0;
371 dauId =
new EvtId[nDaugT];
372 dauMasses =
new double[nDaugT];
373 for ( j = 0; j < nDaugT; j++ )
388 if ( tempPar->
getDaug( 0 ) ==
this )
397 parMass, dauMasses ) );
400 if ( parId )
delete parId;
401 if ( othDauId )
delete othDauId;
402 if ( dauId )
delete[] dauId;
403 if ( dauMasses )
delete[] dauMasses;
450 <<
"if ( _ndaug==1 && (getId()==BS0||getId()==BSB||getId()==BD0||getId()==BDB) )"
469 double massProb = 1.;
473 while ( massProb < ranNum )
483 if ( counter > 10000 )
485 if ( counter == 10001 )
488 <<
"Too many iterations to determine the mass tree. Parent mass= " << p->
mass()
489 << _p <<
" " << massProb << endl;
491 report(
INFO,
"EvtGen" ) <<
"will take next combo with non-zero likelihood\n";
493 if ( massProb > 0. ) massProb = 2.0;
494 if ( counter > 20000 )
504 <<
"Taking the minimum mass of all particles in the chain\n";
508 report(
INFO,
"EvtGen" ) <<
"Sorry, no luck finding a valid set of masses. This "
509 "may be a pathological combo\n";
511 <<
" with momentum " << p->
getP4() << std::endl;
542 dMasses =
new double[nDaug];
543 for ( i = 0; i < nDaug; i++ ) dMasses[i] = p->
getDaug( i )->
mass();
563 for ( i = 0; i < _ndaug; i++ ) { _daug[i]->deleteTree(); }
567 if ( !keepChannel ) _channel = -10;
585 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th polarization vector."
586 <<
" I.e. you thought it was a"
587 <<
" vector particle!" << endl;
595 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th polarization vector."
596 <<
" I.e. you thought it was a"
597 <<
" vector particle!" << endl;
605 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i
606 <<
"th polarization vector of photon."
607 <<
" I.e. you thought it was a"
608 <<
" photon particle!" << endl;
616 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i
617 <<
"th polarization vector of a photon."
618 <<
" I.e. you thought it was a"
619 <<
" photon particle!" << endl;
629 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th dirac spinor."
630 <<
" I.e. you thought it was a"
631 <<
" Dirac particle!" << endl;
641 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th dirac spinor."
642 <<
" I.e. you thought it was a"
643 <<
" Dirac particle!" << endl;
651 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the "
653 <<
" I.e. you thought it was a"
654 <<
" neutrino particle!" << endl;
662 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the "
664 <<
" I.e. you thought it was a"
665 <<
" neutrino particle!" << endl;
675 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th tensor."
676 <<
" I.e. you thought it was a"
677 <<
" Tensor particle!" << endl;
687 report(
ERROR,
"EvtGen" ) <<
"and you have asked for the:" << i <<
"th tensor."
688 <<
" I.e. you thought it was a"
689 <<
" Tensor particle!" << endl;
698 temp = this->
getP4();
704 mom = ptemp->
getP4();
717 temp.
set( 0.0, 0.0, 0.0, 0.0 );
720 if ( ptemp == 0 )
return temp;
722 temp = ( ptemp->_t / ptemp->
mass() ) * ( ptemp->
getP4() );
727 mom = ptemp->
getP4();
729 temp = temp + ( ptemp->_t / ptemp->
mass() ) * ( ptemp->
getP4() );
743 if ( _ndaug != 0 )
return _daug[0];
746 bpart = current->_parent;
747 if ( bpart == 0 )
return 0;
749 while ( bpart->_daug[i] != current ) { i++; }
751 if ( bpart == rootOfTree )
753 if ( i == bpart->_ndaug - 1 )
return 0;
759 }
while ( i >= bpart->_ndaug );
761 return bpart->_daug[i];
765 EvtId* list_of_stable ) {
775 while ( list_of_stable[ii] !=
EvtId( -1, -1 ) )
777 if (
getId() == list_of_stable[ii] )
786 for ( i = 0; i < _ndaug; i++ )
792 for ( i = 0; i < _ndaug; i++ )
793 { _daug[i]->makeStdHepRec( 1 + i, 1 + i, stdhep, secondary, list_of_stable ); }
803 for ( i = 0; i < _ndaug; i++ )
809 for ( i = 0; i < _ndaug; i++ ) { _daug[i]->makeStdHepRec( 1 + i, 1 + i, stdhep ); }
813void EvtParticle::makeStdHepRec(
int firstparent,
int lastparent,
EvtStdHep& stdhep,
821 while ( list_of_stable[ii] !=
EvtId( -1, -1 ) )
823 if (
getId() == list_of_stable[ii] )
833 for ( i = 0; i < _ndaug; i++ )
839 for ( i = 0; i < _ndaug; i++ )
841 _daug[i]->makeStdHepRec( parent_num + i, parent_num + i, stdhep, secondary,
847void EvtParticle::makeStdHepRec(
int firstparent,
int lastparent,
EvtStdHep& stdhep ) {
851 for ( i = 0; i < _ndaug; i++ )
857 for ( i = 0; i < _ndaug; i++ )
858 { _daug[i]->makeStdHepRec( parent_num + i, parent_num + i, stdhep ); }
865 newlevel = level + 1;
871 for ( i = 0; i < ( 5 * level ); i++ ) {
report(
INFO,
"" ) <<
" "; }
875 for ( i = 0; i < _ndaug; i++ )
877 for ( i = 0; i < _ndaug; i++ ) {
report(
INFO,
"" ) << _daug[i]->mass() <<
" "; }
879 for ( i = 0; i < _ndaug; i++ ) { _daug[i]->printTreeRec( newlevel ); }
885 report(
INFO,
"EvtGen" ) <<
"This is the current decay chain" << endl;
889 report(
INFO,
"EvtGen" ) <<
"End of decay chain." << endl;
895 newlevel = level + 1;
897 std::string retval =
"";
899 for ( i = 0; i < _ndaug; i++ )
905 retval += _daug[i]->treeStrRec( newlevel );
910 if ( i != _ndaug - 1 ) retval +=
" ";
918 std::string retval =
"";
920 if ( resonance ==
EvtPDL::name( _id ).c_str() && _ndaug != 0 )
922 retval = resonance +
": " +
IntToStr( _ndaug ) +
" ";
923 for (
int i = 0; i < _ndaug; i++ )
930 for (
int i = 0; i < _ndaug; i++ ) { _daug[i]->writeTreeRec( resonance ); }
938 newlevel = level + 1;
945 if ( Ids > 0 ) c1 =
"p";
954 report(
INFO,
"" ) << newlevel <<
" " << cid <<
" " << dj;
960 for ( i = 0; i < _ndaug; i++ ) { _daug[i]->dumpTreeRec( newlevel, i ); }
966 report(
INFO,
"EvtGen" ) <<
"This is the current decay chain to dump" << endl;
970 report(
INFO,
"EvtGen" ) <<
"End of decay chain." << endl;
1017 report(
INFO,
"EvtGen" ) <<
"Unknown particle type in EvtParticle::printParticle()"
1021 report(
INFO,
"EvtGen" ) <<
"Number of daughters:" << _ndaug <<
"\n";
1043 int whichTwo1,
int whichTwo2 ) {
1051 static double mass[100];
1064 bool resetDaughters =
false;
1065 if ( numdaughter != this->
getNDaug() && this->
getNDaug() > 0 ) resetDaughters =
true;
1066 if ( numdaughter == this->
getNDaug() )
1067 for ( i = 0; i < numdaughter; i++ )
1069 if ( this->
getDaug( i )->
getId() != daughters[i] ) resetDaughters =
true;
1073 if ( resetDaughters )
1091 for ( i = 0; i < numdaughter; i++ )
1098 if ( poleSize < -0.1 )
1101 for ( i = 0; i < numdaughter; i++ ) { this->
getDaug( i )->
init( daughters[i], p4[i] ); }
1105 if ( numdaughter != 3 )
1107 report(
ERROR,
"EvtGen" ) <<
"Only can generate pole phase space "
1108 <<
"distributions for 3 body final states" << endl
1109 <<
"Will terminate." << endl;
1113 if ( ( whichTwo1 == 1 && whichTwo2 == 0 ) || ( whichTwo1 == 0 && whichTwo2 == 1 ) )
1122 if ( ( whichTwo1 == 1 && whichTwo2 == 2 ) || ( whichTwo1 == 2 && whichTwo2 == 1 ) )
1130 if ( ( whichTwo1 == 0 && whichTwo2 == 2 ) || ( whichTwo1 == 2 && whichTwo2 == 0 ) )
1140 report(
ERROR,
"EvtGen" ) <<
"Invalid pair of particle to generate a pole dist"
1141 << whichTwo1 <<
" " << whichTwo2 << endl
1142 <<
"Will terminate." << endl;
1161 if ( _ndaug != ndaugstore )
1163 report(
ERROR,
"EvtGen" ) <<
"Asking to make a different number of "
1164 <<
"daughters than what was previously created." << endl
1165 <<
"Will terminate." << endl;
1171 for ( i = 0; i < ndaugstore; i++ )
1174 pdaug->
setId(
id[i] );
1183 if ( _decayProb == 0 ) _decayProb =
new double;
1194 ans += char( a % 10 + 48 );
1197 for (
int i = ans.size() - 1; i >= 0; i-- ) { ans1 += ans[i]; }
Evt3Rank3C conj(const Evt3Rank3C &t2)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void init_photon(EvtParticle **part)
void init_dirac(EvtParticle **part)
void init_neutrino(EvtParticle **part)
std::string IntToStr(int a)
void init_vector(EvtParticle **part)
void init_raritaschinger(EvtParticle **part)
void init_tensor(EvtParticle **part)
void init_scalar(EvtParticle **part)
void init_string(EvtParticle **part)
std::string IntToStr(int a)
ostream & report(Severity severity, const char *facility)
*********DOUBLE PRECISION m_pi INTEGER m_lenwt !max no of aux weights INTEGER m_phmax !maximum photon multiplicity ISR FSR *DOUBLE COMPLEX m_Pauli4 DOUBLE COMPLEX m_AmpBorn DOUBLE COMPLEX m_AmpBoxy DOUBLE COMPLEX m_AmpBorn1 DOUBLE COMPLEX m_AmpBorn2 DOUBLE COMPLEX m_AmpExpo2p DOUBLE COMPLEX m_Rmat DOUBLE COMPLEX m_BoxGZut !DOUBLE COMPLEX m_F1finPair2 !DOUBLE PRECISION m_Vcut DOUBLE PRECISION m_Alfinv DOUBLE PRECISION m_Lorin1 DOUBLE PRECISION m_Lorin2 DOUBLE PRECISION m_b
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
static void incoherentMix(const EvtId id, double &t, int &mix)
virtual int nRealDaughters()
virtual void makeDecay(EvtParticle *p)=0
static EvtDecayBase * getDecayFunc(EvtParticle *)
static double PhaseSpacePole(double M, double m1, double m2, double m3, double a, EvtVector4R p4[10])
static double PhaseSpace(int ndaug, double mass[30], EvtVector4R p4[30], double mp)
static double getWidth(EvtId i)
static int getStdHep(EvtId id)
static double getRandMass(EvtId i, EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
static double getMeanMass(EvtId i)
static std::string name(EvtId i)
static double getMassProb(EvtId i, double mass, double massPar, int nDaug, double *massDau)
static double getMinMass(EvtId i)
static EvtSpinType::spintype getSpinType(EvtId i)
static double getMass(EvtId i)
static EvtId getId(const std::string &name)
static double getctau(EvtId i)
static EvtParticle * particleFactory(EvtSpinType::spintype spinType)
virtual EvtVector4C epsPhoton(int i)
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
void setDecayProb(double p)
void makeDaughters(int ndaug, EvtId *id)
virtual EvtVector4C epsParent(int i) const
void initDecay(bool useMinMass=false)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void insertDaugPtr(int idaug, EvtParticle *partptr)
virtual EvtTensor4C epsTensorParent(int i) const
virtual EvtVector4C epsParentPhoton(int i)
void printTreeRec(int level) const
EvtParticle * getParent()
virtual EvtDiracSpinor spParentNeutrino() const
static EvtId _NextLevelId[20]
virtual EvtDiracSpinor spParent(int) const
void setVectorSpinDensity()
void printParticle() const
virtual EvtDiracSpinor spNeutrino() const
static int _NextLevelDauNum
int getSpinStates() const
EvtVector4R getP4Restframe()
void setPolarizedSpinDensity(double r00, double r11, double r22)
void setDiagonalSpinDensity()
EvtSpinType::spintype getSpinType() const
const EvtVector4R & getP4() const
void setLifetime(double tau)
virtual EvtSpinDensity rotateToHelicityBasis() const =0
EvtParticle * getDaug(int i)
void dumpTreeRec(int level, int dj) const
void deleteDaughters(bool keepChannel=false)
static EvtVector4R _NextLevelP4[20]
virtual EvtDiracSpinor sp(int) const
void makeStdHep(EvtStdHep &stdhep, EvtSecondary &secondary, EvtId *stable_parent_ihep)
virtual EvtVector4C eps(int i) const
void addDaug(EvtParticle *node)
std::string treeStr() const
std::string treeStrRec(int level) const
virtual EvtTensor4C epsTensor(int i) const
std::string writeTreeRec(std::string) const
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
EvtParticle * nextIter(EvtParticle *rootOfTree=0)
static double Flat(double min, double max)
void init(EvtId part_n, double e, double px, double py, double pz)
void createSecondary(int stdhepindex, EvtParticle *prnt)
const EvtComplex & Get(int i, int j) const
void Set(int i, int j, const EvtComplex &rhoij)
static int getSpinStates(spintype stype)
void createParticle(EvtVector4R p4, EvtVector4R x, int prntfirst, int prntlast, int id)
void set(int i, double d)