EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtParticleFactory.cpp
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
22
25#include "EvtGenBase/EvtId.hh"
27#include "EvtGenBase/EvtPDL.hh"
36
37#include <sys/stat.h>
38
39#include <iostream>
40#include <stdio.h>
41#include <stdlib.h>
42using std::endl;
43
45{
46 if ( spinType == EvtSpinType::SCALAR ) {
47 return new EvtScalarParticle;
48 }
49
50 if ( spinType == EvtSpinType::VECTOR ) {
51 return new EvtVectorParticle;
52 }
53 if ( spinType == EvtSpinType::DIRAC ) {
54 return new EvtDiracParticle;
55 }
56 if ( spinType == EvtSpinType::NEUTRINO ) {
57 return new EvtNeutrinoParticle;
58 }
59 if ( spinType == EvtSpinType::PHOTON ) {
60 return new EvtPhotonParticle;
61 }
62 if ( spinType == EvtSpinType::TENSOR ) {
63 return new EvtTensorParticle;
64 }
65 if ( spinType == EvtSpinType::STRING ) {
66 return new EvtStringParticle;
67 }
68 if ( spinType == EvtSpinType::RARITASCHWINGER ) {
70 }
71 if ( spinType == EvtSpinType::SPIN5HALF ) {
72 return new EvtHighSpinParticle;
73 }
74 if ( spinType == EvtSpinType::SPIN3 ) {
75 return new EvtHighSpinParticle;
76 }
77 if ( spinType == EvtSpinType::SPIN7HALF ) {
78 return new EvtHighSpinParticle;
79 }
80 if ( spinType == EvtSpinType::SPIN4 ) {
81 return new EvtHighSpinParticle;
82 }
83
84 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
85 << "Error in EvtParticleFactory::particleFactory" << endl;
86 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
87 << "Tried to create non-existing particle"
88 << " with spin type:" << spinType << endl;
89 EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Will terminate execution" << endl;
90
91 ::abort();
92
93 return nullptr;
94}
95
97 EvtSpinDensity rho )
98{
100
101 if ( thisSpin == EvtSpinType::SCALAR ) {
102 EvtScalarParticle* myPart;
103 myPart = new EvtScalarParticle;
104 myPart->init( id, p4 );
105 myPart->setSpinDensityForward( rho );
106 return myPart;
107 }
108
109 if ( thisSpin == EvtSpinType::VECTOR ) {
110 EvtVectorParticle* myPart;
111 myPart = new EvtVectorParticle;
112 myPart->init( id, p4 );
113 myPart->setSpinDensityForward( rho );
114 return myPart;
115 }
116 if ( thisSpin == EvtSpinType::DIRAC ) {
117 EvtDiracParticle* myPart;
118 myPart = new EvtDiracParticle;
119 myPart->init( id, p4 );
120 myPart->setSpinDensityForward( rho );
121 return myPart;
122 }
123 if ( thisSpin == EvtSpinType::NEUTRINO ) {
124 EvtNeutrinoParticle* myPart;
125 myPart = new EvtNeutrinoParticle;
126 myPart->init( id, p4 );
127 myPart->setSpinDensityForward( rho );
128 return myPart;
129 }
130 if ( thisSpin == EvtSpinType::PHOTON ) {
131 EvtPhotonParticle* myPart;
132 myPart = new EvtPhotonParticle;
133 myPart->init( id, p4 );
134 myPart->setSpinDensityForward( rho );
135 return myPart;
136 }
137 if ( thisSpin == EvtSpinType::TENSOR ) {
138 EvtTensorParticle* myPart;
139 myPart = new EvtTensorParticle;
140 myPart->init( id, p4 );
141 myPart->setSpinDensityForward( rho );
142 return myPart;
143 }
144 if ( thisSpin == EvtSpinType::STRING ) {
145 EvtStringParticle* myPart;
146 myPart = new EvtStringParticle;
147 myPart->init( id, p4 );
148 myPart->setSpinDensityForward( rho );
149 return myPart;
150 }
151 if ( thisSpin == EvtSpinType::SPIN3 ) {
152 EvtHighSpinParticle* myPart;
153 myPart = new EvtHighSpinParticle;
154 myPart->init( id, p4 );
155 myPart->setSpinDensityForward( rho );
156 return myPart;
157 }
158 if ( thisSpin == EvtSpinType::SPIN5HALF ) {
159 EvtHighSpinParticle* myPart;
160 myPart = new EvtHighSpinParticle;
161 myPart->init( id, p4 );
162 myPart->setSpinDensityForward( rho );
163 return myPart;
164 }
165 if ( thisSpin == EvtSpinType::SPIN7HALF ) {
166 EvtHighSpinParticle* myPart;
167 myPart = new EvtHighSpinParticle;
168 myPart->init( id, p4 );
169 myPart->setSpinDensityForward( rho );
170 return myPart;
171 }
172 if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
174 myPart = new EvtRaritaSchwingerParticle;
175 myPart->init( id, p4 );
176 myPart->setSpinDensityForward( rho );
177 return myPart;
178 }
179 if ( thisSpin == EvtSpinType::SPIN4 ) {
180 EvtHighSpinParticle* myPart;
181 myPart = new EvtHighSpinParticle;
182 myPart->init( id, p4 );
183 myPart->setSpinDensityForward( rho );
184 return myPart;
185 }
186
187 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
188 << "Error in EvtParticleFactory::particleFactory" << endl;
189 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
190 << "Tried to create non-existing particle"
191 << " with spin type:" << thisSpin
192 << " and name:" << EvtPDL::name( id ).c_str() << endl;
193 EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Will terminate execution" << endl;
194
195 ::abort();
196
197 return nullptr;
198}
199
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_ERROR
Definition EvtReport.hh:49
void init(EvtId part_n, const EvtVector4R &p4) override
void init(EvtId id, const EvtVector4R &p) override
Definition EvtId.hh:27
void init(EvtId part_n, const EvtVector4R &p4) override
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.cpp:371
static std::string name(EvtId i)
Definition EvtPDL.cpp:376
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 id, const EvtVector4R &p4) override
void init(EvtId part_n, double e, double px, double py, double pz)
void setDiag(int n)
static int getSpinStates(spintype stype)
void init(EvtId id, const EvtVector4R &p4) override
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)