1 //--------------------------------------------------------------------------
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.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtParticleFactory.cc
13 // Description: Class to describe all particles
15 // Modification history:
17 // DJL December 27, 1999 Module created.
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
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"
42 EvtParticle* EvtParticleFactory::particleFactory(EvtSpinType::spintype spinType){
44 if ( spinType == EvtSpinType::SCALAR ) {
45 return new EvtScalarParticle;
48 if ( spinType == EvtSpinType::VECTOR ) {
49 return new EvtVectorParticle;
51 if ( spinType == EvtSpinType::DIRAC ) {
52 return new EvtDiracParticle;
54 if ( spinType == EvtSpinType::NEUTRINO ) {
55 return new EvtNeutrinoParticle;
57 if ( spinType == EvtSpinType::PHOTON ) {
58 return new EvtPhotonParticle;
60 if ( spinType == EvtSpinType::TENSOR ) {
61 return new EvtTensorParticle;
63 if ( spinType == EvtSpinType::STRING ) {
64 return new EvtStringParticle;
66 if ( spinType == EvtSpinType::RARITASCHWINGER ) {
67 return new EvtRaritaSchwingerParticle;
69 if ( spinType == EvtSpinType::SPIN5HALF ) {
70 return new EvtHighSpinParticle;
72 if ( spinType == EvtSpinType::SPIN3 ) {
73 return new EvtHighSpinParticle;
75 if ( spinType == EvtSpinType::SPIN7HALF ) {
76 return new EvtHighSpinParticle;
78 if ( spinType == EvtSpinType::SPIN4 ) {
79 return new EvtHighSpinParticle;
82 report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
83 report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
84 <<" with spin type:"<<spinType<<endl;
85 report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
96 EvtParticle* EvtParticleFactory::particleFactory(EvtId id,
100 EvtSpinType::spintype thisSpin=EvtPDL::getSpinType(id);
102 if ( thisSpin == EvtSpinType::SCALAR ) {
103 EvtScalarParticle *myPart;
104 myPart=new EvtScalarParticle;
105 myPart->init(id, p4);
106 myPart->setSpinDensityForward(rho);
110 if ( thisSpin == EvtSpinType::VECTOR ) {
111 EvtVectorParticle *myPart;
112 myPart=new EvtVectorParticle;
113 myPart->init(id, p4);
114 myPart->setSpinDensityForward(rho);
117 if ( thisSpin == EvtSpinType::DIRAC ) {
118 EvtDiracParticle *myPart;
119 myPart=new EvtDiracParticle;
120 myPart->init(id, p4);
121 myPart->setSpinDensityForward(rho);
124 if ( thisSpin == EvtSpinType::NEUTRINO ) {
125 EvtNeutrinoParticle *myPart;
126 myPart=new EvtNeutrinoParticle;
127 myPart->init(id, p4);
128 myPart->setSpinDensityForward(rho);
131 if ( thisSpin == EvtSpinType::PHOTON ) {
132 EvtPhotonParticle *myPart;
133 myPart=new EvtPhotonParticle;
134 myPart->init(id, p4);
135 myPart->setSpinDensityForward(rho);
138 if ( thisSpin == EvtSpinType::TENSOR ) {
139 EvtTensorParticle *myPart;
140 myPart=new EvtTensorParticle;
141 myPart->init(id, p4);
142 myPart->setSpinDensityForward(rho);
145 if ( thisSpin == EvtSpinType::STRING ) {
146 EvtStringParticle *myPart;
147 myPart=new EvtStringParticle;
148 myPart->init(id, p4);
149 myPart->setSpinDensityForward(rho);
152 if ( thisSpin == EvtSpinType::SPIN3 ) {
153 EvtHighSpinParticle *myPart;
154 myPart=new EvtHighSpinParticle;
155 myPart->init(id, p4);
156 myPart->setSpinDensityForward(rho);
159 if ( thisSpin == EvtSpinType::SPIN5HALF ) {
160 EvtHighSpinParticle *myPart;
161 myPart=new EvtHighSpinParticle;
162 myPart->init(id, p4);
163 myPart->setSpinDensityForward(rho);
166 if ( thisSpin == EvtSpinType::SPIN7HALF ) {
167 EvtHighSpinParticle *myPart;
168 myPart=new EvtHighSpinParticle;
169 myPart->init(id, p4);
170 myPart->setSpinDensityForward(rho);
173 if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
174 EvtRaritaSchwingerParticle *myPart;
175 myPart=new EvtRaritaSchwingerParticle;
176 myPart->init(id, p4);
177 myPart->setSpinDensityForward(rho);
180 if ( thisSpin == EvtSpinType::SPIN4 ) {
181 EvtHighSpinParticle *myPart;
182 myPart=new EvtHighSpinParticle;
183 myPart->init(id, p4);
184 myPart->setSpinDensityForward(rho);
188 report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
189 report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
190 <<" with spin type:"<<thisSpin
191 <<" and name:"<<EvtPDL::name(id).c_str()<<endl;
192 report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
203 EvtParticle* EvtParticleFactory::particleFactory(EvtId id,
207 rho.setDiag(EvtSpinType::getSpinStates(EvtPDL::getSpinType(id)));
209 return particleFactory(id,p4,rho);