]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 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 | if ( spinType == EvtSpinType::SCALAR ) { | |
45 | return new EvtScalarParticle; | |
46 | } | |
47 | ||
48 | if ( spinType == EvtSpinType::VECTOR ) { | |
49 | return new EvtVectorParticle; | |
50 | } | |
51 | if ( spinType == EvtSpinType::DIRAC ) { | |
52 | return new EvtDiracParticle; | |
53 | } | |
54 | if ( spinType == EvtSpinType::NEUTRINO ) { | |
55 | return new EvtNeutrinoParticle; | |
56 | } | |
57 | if ( spinType == EvtSpinType::PHOTON ) { | |
58 | return new EvtPhotonParticle; | |
59 | } | |
60 | if ( spinType == EvtSpinType::TENSOR ) { | |
61 | return new EvtTensorParticle; | |
62 | } | |
63 | if ( spinType == EvtSpinType::STRING ) { | |
64 | return new EvtStringParticle; | |
65 | } | |
66 | if ( spinType == EvtSpinType::RARITASCHWINGER ) { | |
67 | return new EvtRaritaSchwingerParticle; | |
68 | } | |
69 | if ( spinType == EvtSpinType::SPIN5HALF ) { | |
70 | return new EvtHighSpinParticle; | |
71 | } | |
72 | if ( spinType == EvtSpinType::SPIN3 ) { | |
73 | return new EvtHighSpinParticle; | |
74 | } | |
75 | if ( spinType == EvtSpinType::SPIN7HALF ) { | |
76 | return new EvtHighSpinParticle; | |
77 | } | |
78 | if ( spinType == EvtSpinType::SPIN4 ) { | |
79 | return new EvtHighSpinParticle; | |
80 | } | |
81 | ||
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; | |
86 | ||
87 | ||
88 | ::abort(); | |
89 | ||
90 | return 0; | |
91 | ||
92 | ||
93 | } | |
94 | ||
95 | ||
96 | EvtParticle* EvtParticleFactory::particleFactory(EvtId id, | |
97 | EvtVector4R p4, | |
98 | EvtSpinDensity rho){ | |
99 | ||
100 | EvtSpinType::spintype thisSpin=EvtPDL::getSpinType(id); | |
101 | ||
102 | if ( thisSpin == EvtSpinType::SCALAR ) { | |
103 | EvtScalarParticle *myPart; | |
104 | myPart=new EvtScalarParticle; | |
105 | myPart->init(id, p4); | |
106 | myPart->setSpinDensityForward(rho); | |
107 | return myPart; | |
108 | } | |
109 | ||
110 | if ( thisSpin == EvtSpinType::VECTOR ) { | |
111 | EvtVectorParticle *myPart; | |
112 | myPart=new EvtVectorParticle; | |
113 | myPart->init(id, p4); | |
114 | myPart->setSpinDensityForward(rho); | |
115 | return myPart; | |
116 | } | |
117 | if ( thisSpin == EvtSpinType::DIRAC ) { | |
118 | EvtDiracParticle *myPart; | |
119 | myPart=new EvtDiracParticle; | |
120 | myPart->init(id, p4); | |
121 | myPart->setSpinDensityForward(rho); | |
122 | return myPart; | |
123 | } | |
124 | if ( thisSpin == EvtSpinType::NEUTRINO ) { | |
125 | EvtNeutrinoParticle *myPart; | |
126 | myPart=new EvtNeutrinoParticle; | |
127 | myPart->init(id, p4); | |
128 | myPart->setSpinDensityForward(rho); | |
129 | return myPart; | |
130 | } | |
131 | if ( thisSpin == EvtSpinType::PHOTON ) { | |
132 | EvtPhotonParticle *myPart; | |
133 | myPart=new EvtPhotonParticle; | |
134 | myPart->init(id, p4); | |
135 | myPart->setSpinDensityForward(rho); | |
136 | return myPart; | |
137 | } | |
138 | if ( thisSpin == EvtSpinType::TENSOR ) { | |
139 | EvtTensorParticle *myPart; | |
140 | myPart=new EvtTensorParticle; | |
141 | myPart->init(id, p4); | |
142 | myPart->setSpinDensityForward(rho); | |
143 | return myPart; | |
144 | } | |
145 | if ( thisSpin == EvtSpinType::STRING ) { | |
146 | EvtStringParticle *myPart; | |
147 | myPart=new EvtStringParticle; | |
148 | myPart->init(id, p4); | |
149 | myPart->setSpinDensityForward(rho); | |
150 | return myPart; | |
151 | } | |
152 | if ( thisSpin == EvtSpinType::SPIN3 ) { | |
153 | EvtHighSpinParticle *myPart; | |
154 | myPart=new EvtHighSpinParticle; | |
155 | myPart->init(id, p4); | |
156 | myPart->setSpinDensityForward(rho); | |
157 | return myPart; | |
158 | } | |
159 | if ( thisSpin == EvtSpinType::SPIN5HALF ) { | |
160 | EvtHighSpinParticle *myPart; | |
161 | myPart=new EvtHighSpinParticle; | |
162 | myPart->init(id, p4); | |
163 | myPart->setSpinDensityForward(rho); | |
164 | return myPart; | |
165 | } | |
166 | if ( thisSpin == EvtSpinType::SPIN7HALF ) { | |
167 | EvtHighSpinParticle *myPart; | |
168 | myPart=new EvtHighSpinParticle; | |
169 | myPart->init(id, p4); | |
170 | myPart->setSpinDensityForward(rho); | |
171 | return myPart; | |
172 | } | |
173 | if ( thisSpin == EvtSpinType::RARITASCHWINGER ) { | |
174 | EvtRaritaSchwingerParticle *myPart; | |
175 | myPart=new EvtRaritaSchwingerParticle; | |
176 | myPart->init(id, p4); | |
177 | myPart->setSpinDensityForward(rho); | |
178 | return myPart; | |
179 | } | |
180 | if ( thisSpin == EvtSpinType::SPIN4 ) { | |
181 | EvtHighSpinParticle *myPart; | |
182 | myPart=new EvtHighSpinParticle; | |
183 | myPart->init(id, p4); | |
184 | myPart->setSpinDensityForward(rho); | |
185 | return myPart; | |
186 | } | |
187 | ||
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; | |
193 | ||
194 | ||
195 | ||
196 | ::abort(); | |
197 | ||
198 | return 0; | |
199 | ||
200 | } | |
201 | ||
202 | ||
203 | EvtParticle* EvtParticleFactory::particleFactory(EvtId id, | |
204 | EvtVector4R p4){ | |
205 | ||
206 | EvtSpinDensity rho; | |
207 | rho.setDiag(EvtSpinType::getSpinStates(EvtPDL::getSpinType(id))); | |
208 | ||
209 | return particleFactory(id,p4,rho); | |
210 | ||
211 | } | |
212 | ||
213 | ||
214 | ||
215 | ||
216 |