BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtParticleFactory.cc
Go to the documentation of this file.
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 <fstream>
24#include <stdio.h>
25#include <stdlib.h>
26#include <sys/stat.h>
27#include <strstream>
28#include "EvtGenBase/EvtParticle.hh"
29#include "EvtGenBase/EvtId.hh"
30#include "EvtGenBase/EvtPDL.hh"
31#include "EvtGenBase/EvtDiracParticle.hh"
32#include "EvtGenBase/EvtScalarParticle.hh"
33#include "EvtGenBase/EvtVectorParticle.hh"
34#include "EvtGenBase/EvtTensorParticle.hh"
35#include "EvtGenBase/EvtPhotonParticle.hh"
36#include "EvtGenBase/EvtNeutrinoParticle.hh"
37#include "EvtGenBase/EvtStringParticle.hh"
38#include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
39#include "EvtGenBase/EvtHighSpinParticle.hh"
40#include "EvtGenBase/EvtReport.hh"
41#include "EvtGenBase/EvtParticleFactory.hh"
42using std::endl;
43using std::fstream;
44using std::strstream;
45
47
48 if ( spinType == EvtSpinType::SCALAR ) {
49 return new EvtScalarParticle;
50 }
51
52 if ( spinType == EvtSpinType::VECTOR ) {
53 return new EvtVectorParticle;
54 }
55 if ( spinType == EvtSpinType::DIRAC ) {
56 return new EvtDiracParticle;
57 }
58 if ( spinType == EvtSpinType::NEUTRINO ) {
59 return new EvtNeutrinoParticle;
60 }
61 if ( spinType == EvtSpinType::PHOTON ) {
62 return new EvtPhotonParticle;
63 }
64 if ( spinType == EvtSpinType::TENSOR ) {
65 return new EvtTensorParticle;
66 }
67 if ( spinType == EvtSpinType::STRING ) {
68 return new EvtStringParticle;
69 }
70 if ( spinType == EvtSpinType::RARITASCHWINGER ) {
72 }
73 if ( spinType == EvtSpinType::SPIN5HALF ) {
74 return new EvtHighSpinParticle;
75 }
76 if ( spinType == EvtSpinType::SPIN3 ) {
77 return new EvtHighSpinParticle;
78 }
79 if ( spinType == EvtSpinType::SPIN7HALF ) {
80 return new EvtHighSpinParticle;
81 }
82 if ( spinType == EvtSpinType::SPIN4 ) {
83 return new EvtHighSpinParticle;
84 }
85
86 report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
87 report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
88 <<" with spin type:"<<spinType<<endl;
89 report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
90
91
92 ::abort();
93
94 return 0;
95
96
97}
98
99
101 EvtVector4R p4,
102 EvtSpinDensity rho){
103
105
106 if ( thisSpin == EvtSpinType::SCALAR ) {
107 EvtScalarParticle *myPart;
108 myPart=new EvtScalarParticle;
109 myPart->init(id, p4);
110 myPart->setSpinDensityForward(rho);
111 return myPart;
112 }
113
114 if ( thisSpin == EvtSpinType::VECTOR ) {
115 EvtVectorParticle *myPart;
116 myPart=new EvtVectorParticle;
117 myPart->init(id, p4);
118 myPart->setSpinDensityForward(rho);
119 return myPart;
120 }
121 if ( thisSpin == EvtSpinType::DIRAC ) {
122 EvtDiracParticle *myPart;
123 myPart=new EvtDiracParticle;
124 myPart->init(id, p4);
125 myPart->setSpinDensityForward(rho);
126 return myPart;
127 }
128 if ( thisSpin == EvtSpinType::NEUTRINO ) {
129 EvtNeutrinoParticle *myPart;
130 myPart=new EvtNeutrinoParticle;
131 myPart->init(id, p4);
132 myPart->setSpinDensityForward(rho);
133 return myPart;
134 }
135 if ( thisSpin == EvtSpinType::PHOTON ) {
136 EvtPhotonParticle *myPart;
137 myPart=new EvtPhotonParticle;
138 myPart->init(id, p4);
139 myPart->setSpinDensityForward(rho);
140 return myPart;
141 }
142 if ( thisSpin == EvtSpinType::TENSOR ) {
143 EvtTensorParticle *myPart;
144 myPart=new EvtTensorParticle;
145 myPart->init(id, p4);
146 myPart->setSpinDensityForward(rho);
147 return myPart;
148 }
149 if ( thisSpin == EvtSpinType::STRING ) {
150 EvtStringParticle *myPart;
151 myPart=new EvtStringParticle;
152 myPart->init(id, p4);
153 myPart->setSpinDensityForward(rho);
154 return myPart;
155 }
156 if ( thisSpin == EvtSpinType::SPIN3 ) {
157 EvtHighSpinParticle *myPart;
158 myPart=new EvtHighSpinParticle;
159 myPart->init(id, p4);
160 myPart->setSpinDensityForward(rho);
161 return myPart;
162 }
163 if ( thisSpin == EvtSpinType::SPIN5HALF ) {
164 EvtHighSpinParticle *myPart;
165 myPart=new EvtHighSpinParticle;
166 myPart->init(id, p4);
167 myPart->setSpinDensityForward(rho);
168 return myPart;
169 }
170 if ( thisSpin == EvtSpinType::SPIN7HALF ) {
171 EvtHighSpinParticle *myPart;
172 myPart=new EvtHighSpinParticle;
173 myPart->init(id, p4);
174 myPart->setSpinDensityForward(rho);
175 return myPart;
176 }
177 if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
180 myPart->init(id, p4);
181 myPart->setSpinDensityForward(rho);
182 return myPart;
183 }
184 if ( thisSpin == EvtSpinType::SPIN4 ) {
185 EvtHighSpinParticle *myPart;
186 myPart=new EvtHighSpinParticle;
187 myPart->init(id, p4);
188 myPart->setSpinDensityForward(rho);
189 return myPart;
190 }
191
192 report(ERROR,"EvtGen")<<"Error in EvtParticleFactory::particleFactory"<<endl;
193 report(ERROR,"EvtGen")<<"Tried to create non-existing particle"
194 <<" with spin type:"<<thisSpin
195 <<" and name:"<<EvtPDL::name(id).c_str()<<endl;
196 report(ERROR,"EvtGen")<<"Will terminate execution"<<endl;
197
198
199
200 ::abort();
201
202 return 0;
203
204}
205
206
208 EvtVector4R p4){
209
210 EvtSpinDensity rho;
212
213 return particleFactory(id,p4,rho);
214
215}
216
217
218
219
220
ostream & report(Severity severity, const char *facility)
static EvtSpinType::spintype getSpinType(EvtId i)
static EvtParticle * particleFactory(EvtSpinType::spintype spinType)
void setSpinDensityForward(const EvtSpinDensity &rho)
void init(EvtId part_n, double e, double px, double py, double pz)
void init(EvtId part_n, double e, double px, double py, double pz)
void init(EvtId part_n, double e, double px, double py, double pz)
void init(EvtId part_n, double e, double px, double py, double pz)