21#include "EvtGenBase/EvtPatches.hh"
29#include "EvtGenBase/EvtParticle.hh"
30#include "EvtGenBase/EvtId.hh"
31#include "EvtGenBase/EvtRandom.hh"
32#include "EvtGenBase/EvtRadCorr.hh"
33#include "EvtGenBase/EvtPDL.hh"
34#include "EvtGenBase/EvtDecayTable.hh"
35#include "EvtGenBase/EvtDiracParticle.hh"
36#include "EvtGenBase/EvtScalarParticle.hh"
37#include "EvtGenBase/EvtVectorParticle.hh"
38#include "EvtGenBase/EvtTensorParticle.hh"
39#include "EvtGenBase/EvtPhotonParticle.hh"
40#include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
41#include "EvtGenBase/EvtNeutrinoParticle.hh"
42#include "EvtGenBase/EvtStringParticle.hh"
43#include "EvtGenBase/EvtStdHep.hh"
44#include "EvtGenBase/EvtSecondary.hh"
45#include "EvtGenBase/EvtReport.hh"
46#include "EvtGenBase/EvtGenKine.hh"
47#include "EvtGenBase/EvtCPUtil.hh"
48#include "EvtGenBase/EvtParticleFactory.hh"
49#include "EvtGenBase/EvtSpinDensity.hh"
105 node->_daug[node->_ndaug++]=
this;
141 report(
ERROR,
"EvtGen")<<
"Error in EvtParticle::setVectorSpinDensity"<<endl;
160 report(
ERROR,
"EvtGen")<<
"Error in EvtParticle::setVectorSpinDensity"<<endl;
182 assert(R.GetDim()==rho.
GetDim());
195 tmp+=R.Get(l,i)*rho.
Get(l,k)*
conj(R.Get(k,j));
198 _rhoForward.
Set(i,j,tmp);
213 assert(R.GetDim()==rho.
GetDim());
226 tmp+=R.Get(l,i)*rho.
Get(l,k)*
conj(R.Get(k,j));
229 _rhoForward.
Set(i,j,tmp);
257 for(ii=0;ii<_ndaug;ii++){
268 dauId=
new EvtId[_ndaug];
269 dauMasses=
new double[_ndaug];
270 for (j=0;j<_ndaug;j++) {
289 if ( parId)
delete parId;
290 if ( othDauId)
delete othDauId;
291 if ( dauId)
delete [] dauId;
292 if ( dauMasses)
delete [] dauMasses;
318 scalar_part->
init(BSB,p_init);
320 else if (
getId()==BSB) {
322 scalar_part->
init(BS0,p_init);
324 else if (
getId()==BD0) {
326 scalar_part->
init(BDB,p_init);
328 else if (
getId()==BDB) {
330 scalar_part->
init(BD0,p_init);
374 dauId=
new EvtId[nDaugT];
375 dauMasses=
new double[nDaugT];
376 for (j=0;j<nDaugT;j++) {
396 if ( parId)
delete parId;
397 if ( othDauId)
delete othDauId;
398 if ( dauId)
delete [] dauId;
399 if ( dauMasses)
delete [] dauMasses;
443 std::cout<<
"if ( _ndaug==1 && (getId()==BS0||getId()==BSB||getId()==BD0||getId()==BDB) )"<<endl;
466 while (massProb<ranNum) {
475 if ( counter > 10000 ) {
476 if ( counter == 10001 ) {
477 report(
INFO,
"EvtGen") <<
"Too many iterations to determine the mass tree. Parent mass= "<< p->
mass() << _p<<
" " << massProb <<endl;
479 report(
INFO,
"EvtGen") <<
"will take next combo with non-zero likelihood\n";
481 if ( massProb>0. ) massProb=2.0;
482 if ( counter > 20000 ) {
489 report(
INFO,
"EvtGen") <<
"Taking the minimum mass of all particles in the chain\n";
492 report(
INFO,
"EvtGen") <<
"Sorry, no luck finding a valid set of masses. This may be a pathological combo\n";
520 dMasses=
new double[nDaug];
521 for (i=0; i<nDaug; i++) dMasses[i]=p->
getDaug(i)->
mass();
534 for (i=0; i<nDaug; i++) {
543 for(i=0;i<_ndaug;i++){
549 if ( !keepChannel) _channel=-10;
568 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
569 <<
"th polarization vector."
570 <<
" I.e. you thought it was a"
571 <<
" vector particle!" << endl;
579 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
580 <<
"th polarization vector."
581 <<
" I.e. you thought it was a"
582 <<
" vector particle!" << endl;
590 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
591 <<
"th polarization vector of photon."
592 <<
" I.e. you thought it was a"
593 <<
" photon particle!" << endl;
601 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
602 <<
"th polarization vector of a photon."
603 <<
" I.e. you thought it was a"
604 <<
" photon particle!" << endl;
614 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
616 <<
" I.e. you thought it was a"
617 <<
" Dirac particle!" << endl;
627 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
629 <<
" I.e. you thought it was a"
630 <<
" Dirac particle!" << endl;
638 report(
ERROR,
"EvtGen") <<
"and you have asked for the "
640 <<
" I.e. you thought it was a"
641 <<
" neutrino particle!" << endl;
649 report(
ERROR,
"EvtGen") <<
"and you have asked for the "
651 <<
" I.e. you thought it was a"
652 <<
" neutrino particle!" << endl;
662 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
664 <<
" I.e. you thought it was a"
665 <<
" Tensor particle!" << endl;
675 report(
ERROR,
"EvtGen") <<
"and you have asked for the:"<<i
677 <<
" I.e. you thought it was a"
678 <<
" Tensor particle!" << endl;
711 temp.
set(0.0,0.0,0.0,0.0);
714 if (ptemp==0)
return temp;
716 temp=(ptemp->_t/ptemp->
mass())*(ptemp->
getP4());
722 temp=temp+(ptemp->_t/ptemp->
mass())*(ptemp->
getP4());
737 if (_ndaug!=0)
return _daug[0];
740 bpart=current->_parent;
741 if (bpart==0)
return 0;
743 while (bpart->_daug[i]!=current) {i++;}
745 if ( bpart==rootOfTree ) {
746 if ( i== bpart->_ndaug-1 )
return 0;
752 }
while(i>=bpart->_ndaug);
754 return bpart->_daug[i];
760 EvtId *list_of_stable){
771 while (list_of_stable[ii]!=
EvtId(-1,-1)) {
772 if (
getId()==list_of_stable[ii]){
783 for(i=0;i<_ndaug;i++){
788 for(i=0;i<_ndaug;i++){
789 _daug[i]->makeStdHepRec(1+i,1+i,stdhep,secondary,list_of_stable);
802 for(i=0;i<_ndaug;i++){
807 for(i=0;i<_ndaug;i++){
808 _daug[i]->makeStdHepRec(1+i,1+i,stdhep);
815void EvtParticle::makeStdHepRec(
int firstparent,
int lastparent,
818 EvtId *list_of_stable){
826 while (list_of_stable[ii]!=
EvtId(-1,-1)) {
827 if (
getId()==list_of_stable[ii]){
838 for(i=0;i<_ndaug;i++){
840 firstparent,lastparent,
844 for(i=0;i<_ndaug;i++){
845 _daug[i]->makeStdHepRec(parent_num+i,parent_num+i,stdhep,
846 secondary,list_of_stable);
852void EvtParticle::makeStdHepRec(
int firstparent,
int lastparent,
857 for(i=0;i<_ndaug;i++){
859 firstparent,lastparent,
863 for(i=0;i<_ndaug;i++){
864 _daug[i]->makeStdHepRec(parent_num+i,parent_num+i,stdhep);
878 for (i=0;i<(5*level);i++) {
884 for(i=0;i<_ndaug;i++){
887 for(i=0;i<_ndaug;i++){
891 for(i=0;i<_ndaug;i++){
899 report(
INFO,
"EvtGen") <<
"This is the current decay chain"<<endl;
904 report(
INFO,
"EvtGen") <<
"End of decay chain."<<endl;
913 std::string retval=
"";
915 for(i=0;i<_ndaug;i++){
923 if ( i!=_ndaug-1) retval+=
" ";
931 std::string retval=
"";
933 if (resonance ==
EvtPDL::name(_id).c_str() && _ndaug!=0) {
934 retval=resonance+
": "+
IntToStr(_ndaug)+
" ";
935 for(
int i=0;i<_ndaug;i++){
941 for(
int i=0;i<_ndaug;i++){
965 report(
INFO,
"") <<newlevel<<
" "<< cid<<
" "<<dj;
971 for(i=0;i<_ndaug;i++){
980 report(
INFO,
"EvtGen") <<
"This is the current decay chain to dump"<<endl;
985 report(
INFO,
"EvtGen") <<
"End of decay chain."<<endl;
1028 report(
INFO,
"EvtGen") <<
"Unknown particle type in EvtParticle::printParticle()"<<endl;
1031 report(
INFO,
"EvtGen") <<
"Number of daughters:"<<_ndaug<<
"\n";
1072 int numdaughter,
EvtId *daughters,
double poleSize,
1073 int whichTwo1,
int whichTwo2) {
1081 static double mass[100];
1094 bool resetDaughters=
false;
1095 if ( numdaughter != this->
getNDaug() && this->
getNDaug() > 0 ) resetDaughters=
true;
1096 if ( numdaughter == this->
getNDaug() )
1097 for (i=0; i<numdaughter;i++) {
1098 if ( this->
getDaug(i)->
getId() != daughters[i] ) resetDaughters=
true;
1102 if ( resetDaughters ) {
1118 for (i=0; i<numdaughter;i++) {
1123 if ( poleSize<-0.1) {
1125 for(i=0;i<numdaughter;i++){
1131 if ( numdaughter != 3 ) {
1132 report(
ERROR,
"EvtGen") <<
"Only can generate pole phase space "
1133 <<
"distributions for 3 body final states"
1134 << endl<<
"Will terminate."<<endl;
1138 if ( (whichTwo1 == 1 && whichTwo2 == 0 ) ||
1139 (whichTwo1 == 0 && whichTwo2 == 1 ) ) {
1148 if ( (whichTwo1 == 1 && whichTwo2 == 2 ) ||
1149 (whichTwo1 == 2 && whichTwo2 == 1 ) ) {
1157 if ( (whichTwo1 == 0 && whichTwo2 == 2 ) ||
1158 (whichTwo1 == 2 && whichTwo2 == 0 ) ) {
1167 report(
ERROR,
"EvtGen") <<
"Invalid pair of particle to generate a pole dist"
1168 << whichTwo1 <<
" " << whichTwo2
1169 << endl<<
"Will terminate."<<endl;
1180 if ( _channel < 0 ) {
1186 if (_ndaug!=ndaugstore){
1187 report(
ERROR,
"EvtGen") <<
"Asking to make a different number of "
1188 <<
"daughters than what was previously created."
1189 << endl<<
"Will terminate."<<endl;
1194 for(i=0;i<ndaugstore;i++){
1196 pdaug->
setId(
id[i]);
1206 if ( _decayProb == 0 ) _decayProb=
new double;
1218 ans += char (a % 10 + 48 );
1221 for (
int i = ans.size() - 1 ; i >= 0 ; i -- )
std::string IntToStr(int a)
*********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
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)
ostream & report(Severity severity, const char *facility)
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
virtual EvtDiracSpinor spParent(int) const
void setVectorSpinDensity()
void printParticle() const
virtual EvtDiracSpinor spNeutrino() const
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)
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)
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)