LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtParticleFactory.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 90 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 3 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : //
       3             : // Environment:
       4             : //      This software is part of the EvtGen package developed jointly
       5             : //      for the BaBar and CLEO collaborations.  If you use all or part
       6             : //      of it, please give an appropriate acknowledgement.
       7             : //
       8             : // Copyright Information: See EvtGen/COPYRIGHT
       9             : //      Copyright (C) 1998      Caltech, UCSB
      10             : //
      11             : // Module: EvtParticleFactory.cc
      12             : //
      13             : // Description: Class to describe all particles
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    DJL December 27, 1999 Module created.
      18             : //
      19             : //------------------------------------------------------------------------
      20             : // 
      21             : #include "EvtGenBase/EvtPatches.hh"
      22             : #include <iostream>
      23             : #include <stdio.h>
      24             : #include <stdlib.h>
      25             : #include <sys/stat.h>
      26             : #include "EvtGenBase/EvtParticle.hh"
      27             : #include "EvtGenBase/EvtId.hh"
      28             : #include "EvtGenBase/EvtPDL.hh"
      29             : #include "EvtGenBase/EvtDiracParticle.hh"
      30             : #include "EvtGenBase/EvtScalarParticle.hh"
      31             : #include "EvtGenBase/EvtVectorParticle.hh"
      32             : #include "EvtGenBase/EvtTensorParticle.hh"
      33             : #include "EvtGenBase/EvtPhotonParticle.hh"
      34             : #include "EvtGenBase/EvtNeutrinoParticle.hh"
      35             : #include "EvtGenBase/EvtStringParticle.hh"
      36             : #include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
      37             : #include "EvtGenBase/EvtHighSpinParticle.hh"
      38             : #include "EvtGenBase/EvtReport.hh"
      39             : #include "EvtGenBase/EvtParticleFactory.hh"
      40             : using std::endl;
      41             : 
      42             : EvtParticle* EvtParticleFactory::particleFactory(EvtSpinType::spintype spinType){
      43             : 
      44           0 :   if ( spinType == EvtSpinType::SCALAR ) {
      45           0 :     return new EvtScalarParticle;
      46             :   }
      47             : 
      48           0 :   if ( spinType == EvtSpinType::VECTOR ) {
      49           0 :     return new EvtVectorParticle;
      50             :   }
      51           0 :   if ( spinType == EvtSpinType::DIRAC ) {
      52           0 :     return new EvtDiracParticle;
      53             :   }
      54           0 :   if ( spinType == EvtSpinType::NEUTRINO ) {
      55           0 :     return new EvtNeutrinoParticle;
      56             :   }
      57           0 :   if ( spinType == EvtSpinType::PHOTON ) {
      58           0 :     return new EvtPhotonParticle;
      59             :   }
      60           0 :   if ( spinType == EvtSpinType::TENSOR ) {
      61           0 :     return new EvtTensorParticle;
      62             :   }
      63           0 :   if ( spinType == EvtSpinType::STRING ) {
      64           0 :     return new EvtStringParticle;
      65             :   }
      66           0 :   if ( spinType == EvtSpinType::RARITASCHWINGER ) {
      67           0 :     return new EvtRaritaSchwingerParticle;
      68             :   }
      69           0 :   if ( spinType == EvtSpinType::SPIN5HALF ) {
      70           0 :     return new EvtHighSpinParticle;
      71             :   }
      72           0 :   if ( spinType == EvtSpinType::SPIN3 ) {
      73           0 :     return new EvtHighSpinParticle;
      74             :   }
      75           0 :   if ( spinType == EvtSpinType::SPIN7HALF ) {
      76           0 :     return new EvtHighSpinParticle;
      77             :   }
      78           0 :   if ( spinType == EvtSpinType::SPIN4 ) {
      79           0 :     return new EvtHighSpinParticle;
      80             :   }
      81             : 
      82           0 :   report(Severity::Error,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
      83           0 :   report(Severity::Error,"EvtGen")<<"Tried to create non-existing particle"
      84           0 :                         <<" with spin type:"<<spinType<<endl;
      85           0 :   report(Severity::Error,"EvtGen")<<"Will terminate execution"<<endl;
      86             : 
      87             : 
      88           0 :   ::abort();
      89             : 
      90             :   return 0;
      91             :   
      92             : 
      93           0 : }
      94             : 
      95             : 
      96             : EvtParticle* EvtParticleFactory::particleFactory(EvtId id, 
      97             :                                                  EvtVector4R p4,
      98             :                                                  EvtSpinDensity rho){
      99             : 
     100           0 :   EvtSpinType::spintype thisSpin=EvtPDL::getSpinType(id);
     101             : 
     102           0 :   if ( thisSpin == EvtSpinType::SCALAR ) {
     103             :     EvtScalarParticle *myPart;
     104           0 :     myPart=new EvtScalarParticle;
     105           0 :     myPart->init(id, p4);
     106           0 :     myPart->setSpinDensityForward(rho);
     107             :     return myPart;
     108             :   }
     109             : 
     110           0 :   if ( thisSpin == EvtSpinType::VECTOR ) {
     111             :     EvtVectorParticle *myPart;
     112           0 :     myPart=new EvtVectorParticle;
     113           0 :     myPart->init(id, p4);
     114           0 :     myPart->setSpinDensityForward(rho);
     115             :     return myPart;
     116             :   }
     117           0 :   if ( thisSpin == EvtSpinType::DIRAC ) {
     118             :     EvtDiracParticle *myPart;
     119           0 :     myPart=new EvtDiracParticle;
     120           0 :     myPart->init(id, p4);
     121           0 :     myPart->setSpinDensityForward(rho);
     122             :     return myPart;
     123             :   }
     124           0 :   if ( thisSpin == EvtSpinType::NEUTRINO ) {
     125             :     EvtNeutrinoParticle *myPart;
     126           0 :     myPart=new EvtNeutrinoParticle;
     127           0 :     myPart->init(id, p4);
     128           0 :     myPart->setSpinDensityForward(rho);
     129             :     return myPart;
     130             :   }
     131           0 :   if ( thisSpin == EvtSpinType::PHOTON ) {
     132             :     EvtPhotonParticle *myPart;
     133           0 :     myPart=new EvtPhotonParticle;
     134           0 :     myPart->init(id, p4);
     135           0 :     myPart->setSpinDensityForward(rho);
     136             :     return myPart;
     137             :   }
     138           0 :   if ( thisSpin == EvtSpinType::TENSOR ) {
     139             :     EvtTensorParticle *myPart;
     140           0 :     myPart=new EvtTensorParticle;
     141           0 :     myPart->init(id, p4);
     142           0 :     myPart->setSpinDensityForward(rho);
     143             :     return myPart;
     144             :   }
     145           0 :   if ( thisSpin == EvtSpinType::STRING ) {
     146             :     EvtStringParticle *myPart;
     147           0 :     myPart=new EvtStringParticle;
     148           0 :     myPart->init(id, p4);
     149           0 :     myPart->setSpinDensityForward(rho);
     150             :     return myPart;
     151             :   }
     152           0 :   if ( thisSpin == EvtSpinType::SPIN3 ) {
     153             :     EvtHighSpinParticle *myPart;
     154           0 :     myPart=new EvtHighSpinParticle;
     155           0 :     myPart->init(id, p4);
     156           0 :     myPart->setSpinDensityForward(rho);
     157             :     return myPart;
     158             :   }
     159           0 :   if ( thisSpin == EvtSpinType::SPIN5HALF ) {
     160             :     EvtHighSpinParticle *myPart;
     161           0 :     myPart=new EvtHighSpinParticle;
     162           0 :     myPart->init(id, p4);
     163           0 :     myPart->setSpinDensityForward(rho);
     164             :     return myPart;
     165             :   }
     166           0 :   if ( thisSpin == EvtSpinType::SPIN7HALF ) {
     167             :     EvtHighSpinParticle *myPart;
     168           0 :     myPart=new EvtHighSpinParticle;
     169           0 :     myPart->init(id, p4);
     170           0 :     myPart->setSpinDensityForward(rho);
     171             :     return myPart;
     172             :   }
     173           0 :   if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
     174             :     EvtRaritaSchwingerParticle *myPart;
     175           0 :     myPart=new EvtRaritaSchwingerParticle;
     176           0 :     myPart->init(id, p4);
     177           0 :     myPart->setSpinDensityForward(rho);
     178             :     return myPart;
     179             :   }
     180           0 :   if ( thisSpin == EvtSpinType::SPIN4 ) {
     181             :     EvtHighSpinParticle *myPart;
     182           0 :     myPart=new EvtHighSpinParticle;
     183           0 :     myPart->init(id, p4);
     184           0 :     myPart->setSpinDensityForward(rho);
     185             :     return myPart;
     186             :   }
     187             : 
     188           0 :   report(Severity::Error,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
     189           0 :   report(Severity::Error,"EvtGen")<<"Tried to create non-existing particle"
     190           0 :                         <<" with spin type:"<<thisSpin
     191           0 :                         <<"  and name:"<<EvtPDL::name(id).c_str()<<endl;
     192           0 :   report(Severity::Error,"EvtGen")<<"Will terminate execution"<<endl;
     193             : 
     194             : 
     195             : 
     196           0 :   ::abort();
     197             : 
     198             :   return 0;
     199             : 
     200           0 : }
     201             : 
     202             : 
     203             : EvtParticle* EvtParticleFactory::particleFactory(EvtId id, 
     204             :                                                  EvtVector4R p4){
     205             : 
     206           0 :   EvtSpinDensity rho;
     207           0 :   rho.setDiag(EvtSpinType::getSpinStates(EvtPDL::getSpinType(id)));
     208             : 
     209           0 :   return particleFactory(id,p4,rho);
     210             : 
     211           0 : }
     212             : 
     213             : 
     214             : 
     215             : 
     216             : 

Generated by: LCOV version 1.11