/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtParticleFactory.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of the EvtGen package developed jointly
00005 //      for the BaBar and CLEO collaborations.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/COPYRIGHT
00009 //      Copyright (C) 1998      Caltech, UCSB
00010 //
00011 // Module: EvtParticleFactory.cc
00012 //
00013 // Description: Class to describe all particles
00014 //
00015 // Modification history:
00016 //
00017 //    DJL December 27, 1999 Module created.
00018 //
00019 //------------------------------------------------------------------------
00020 // 
00021 #include "EvtGenBase/EvtPatches.hh"
00022 #include <iostream>
00023 #include <fstream>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <sys/stat.h>
00027 #include <strstream>
00028 #include "EvtGenBase/EvtParticle.hh"
00029 #include "EvtGenBase/EvtId.hh"
00030 #include "EvtGenBase/EvtPDL.hh"
00031 #include "EvtGenBase/EvtDiracParticle.hh"
00032 #include "EvtGenBase/EvtScalarParticle.hh"
00033 #include "EvtGenBase/EvtVectorParticle.hh"
00034 #include "EvtGenBase/EvtTensorParticle.hh"
00035 #include "EvtGenBase/EvtPhotonParticle.hh"
00036 #include "EvtGenBase/EvtNeutrinoParticle.hh"
00037 #include "EvtGenBase/EvtStringParticle.hh"
00038 #include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
00039 #include "EvtGenBase/EvtHighSpinParticle.hh"
00040 #include "EvtGenBase/EvtReport.hh"
00041 #include "EvtGenBase/EvtParticleFactory.hh"
00042 using std::endl;
00043 using std::fstream;
00044 using std::strstream;
00045 
00046 EvtParticle* EvtParticleFactory::particleFactory(EvtSpinType::spintype spinType){
00047 
00048   if ( spinType == EvtSpinType::SCALAR ) {
00049     return new EvtScalarParticle;
00050   }
00051 
00052   if ( spinType == EvtSpinType::VECTOR ) {
00053     return new EvtVectorParticle;
00054   }
00055   if ( spinType == EvtSpinType::DIRAC ) {
00056     return new EvtDiracParticle;
00057   }
00058   if ( spinType == EvtSpinType::NEUTRINO ) {
00059     return new EvtNeutrinoParticle;
00060   }
00061   if ( spinType == EvtSpinType::PHOTON ) {
00062     return new EvtPhotonParticle;
00063   }
00064   if ( spinType == EvtSpinType::TENSOR ) {
00065     return new EvtTensorParticle;
00066   }
00067   if ( spinType == EvtSpinType::STRING ) {
00068     return new EvtStringParticle;
00069   }
00070   if ( spinType == EvtSpinType::RARITASCHWINGER ) {
00071     return new EvtRaritaSchwingerParticle;
00072   }
00073   if ( spinType == EvtSpinType::SPIN5HALF ) {
00074     return new EvtHighSpinParticle;
00075   }
00076   if ( spinType == EvtSpinType::SPIN3 ) {
00077     return new EvtHighSpinParticle;
00078   }
00079   if ( spinType == EvtSpinType::SPIN7HALF ) {
00080     return new EvtHighSpinParticle;
00081   }
00082   if ( spinType == EvtSpinType::SPIN4 ) {
00083     return new EvtHighSpinParticle;
00084   }
00085 
00086   report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
00087   report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
00088                         <<" with spin type:"<<spinType<<endl;
00089   report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
00090 
00091 
00092   ::abort();
00093 
00094   return 0;
00095   
00096 
00097 }
00098 
00099 
00100 EvtParticle* EvtParticleFactory::particleFactory(EvtId id, 
00101                                                  EvtVector4R p4,
00102                                                  EvtSpinDensity rho){
00103 
00104   EvtSpinType::spintype thisSpin=EvtPDL::getSpinType(id);
00105 
00106   if ( thisSpin == EvtSpinType::SCALAR ) {
00107     EvtScalarParticle *myPart;
00108     myPart=new EvtScalarParticle;
00109     myPart->init(id, p4);
00110     myPart->setSpinDensityForward(rho);
00111     return myPart;
00112   }
00113 
00114   if ( thisSpin == EvtSpinType::VECTOR ) {
00115     EvtVectorParticle *myPart;
00116     myPart=new EvtVectorParticle;
00117     myPart->init(id, p4);
00118     myPart->setSpinDensityForward(rho);
00119     return myPart;
00120   }
00121   if ( thisSpin == EvtSpinType::DIRAC ) {
00122     EvtDiracParticle *myPart;
00123     myPart=new EvtDiracParticle;
00124     myPart->init(id, p4);
00125     myPart->setSpinDensityForward(rho);
00126     return myPart;
00127   }
00128   if ( thisSpin == EvtSpinType::NEUTRINO ) {
00129     EvtNeutrinoParticle *myPart;
00130     myPart=new EvtNeutrinoParticle;
00131     myPart->init(id, p4);
00132     myPart->setSpinDensityForward(rho);
00133     return myPart;
00134   }
00135   if ( thisSpin == EvtSpinType::PHOTON ) {
00136     EvtPhotonParticle *myPart;
00137     myPart=new EvtPhotonParticle;
00138     myPart->init(id, p4);
00139     myPart->setSpinDensityForward(rho);
00140     return myPart;
00141   }
00142   if ( thisSpin == EvtSpinType::TENSOR ) {
00143     EvtTensorParticle *myPart;
00144     myPart=new EvtTensorParticle;
00145     myPart->init(id, p4);
00146     myPart->setSpinDensityForward(rho);
00147     return myPart;
00148   }
00149   if ( thisSpin == EvtSpinType::STRING ) {
00150     EvtStringParticle *myPart;
00151     myPart=new EvtStringParticle;
00152     myPart->init(id, p4);
00153     myPart->setSpinDensityForward(rho);
00154     return myPart;
00155   }
00156   if ( thisSpin == EvtSpinType::SPIN3 ) {
00157     EvtHighSpinParticle *myPart;
00158     myPart=new EvtHighSpinParticle;
00159     myPart->init(id, p4);
00160     myPart->setSpinDensityForward(rho);
00161     return myPart;
00162   }
00163   if ( thisSpin == EvtSpinType::SPIN5HALF ) {
00164     EvtHighSpinParticle *myPart;
00165     myPart=new EvtHighSpinParticle;
00166     myPart->init(id, p4);
00167     myPart->setSpinDensityForward(rho);
00168     return myPart;
00169   }
00170   if ( thisSpin == EvtSpinType::SPIN7HALF ) {
00171     EvtHighSpinParticle *myPart;
00172     myPart=new EvtHighSpinParticle;
00173     myPart->init(id, p4);
00174     myPart->setSpinDensityForward(rho);
00175     return myPart;
00176   }
00177   if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
00178     EvtRaritaSchwingerParticle *myPart;
00179     myPart=new EvtRaritaSchwingerParticle;
00180     myPart->init(id, p4);
00181     myPart->setSpinDensityForward(rho);
00182     return myPart;
00183   }
00184   if ( thisSpin == EvtSpinType::SPIN4 ) {
00185     EvtHighSpinParticle *myPart;
00186     myPart=new EvtHighSpinParticle;
00187     myPart->init(id, p4);
00188     myPart->setSpinDensityForward(rho);
00189     return myPart;
00190   }
00191 
00192   report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
00193   report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
00194                         <<" with spin type:"<<thisSpin
00195                         <<"  and name:"<<EvtPDL::name(id).c_str()<<endl;
00196   report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
00197 
00198 
00199 
00200   ::abort();
00201 
00202   return 0;
00203 
00204 }
00205 
00206 
00207 EvtParticle* EvtParticleFactory::particleFactory(EvtId id, 
00208                                                  EvtVector4R p4){
00209 
00210   EvtSpinDensity rho;
00211   rho.SetDiag(EvtSpinType::getSpinStates(EvtPDL::getSpinType(id)));
00212 
00213   return particleFactory(id,p4,rho);
00214 
00215 }
00216 
00217 
00218 
00219 
00220 

Generated on Tue Nov 29 23:12:14 2016 for BOSS_7.0.2 by  doxygen 1.4.7