ROOTPWA
amplitude/particle.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright 2010
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa 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 // rootpwa 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 rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 //-------------------------------------------------------------------------
22 // File and Version Information:
23 // $Rev:: $: revision of last commit
24 // $Author:: $: author of last commit
25 // $Date:: $: date of last commit
26 //
27 // Description:
28 // container class for all external particle related information
29 //
30 //
31 // Author List:
32 // Boris Grube TUM (original author)
33 //
34 //
35 //-------------------------------------------------------------------------
36 
37 
38 #include "reportingUtils.hpp"
39 #include "reportingUtilsRoot.hpp"
40 #include "conversionUtils.hpp"
41 #include "particle.h"
42 
43 
44 using namespace std;
45 using namespace rpwa;
46 
47 
48 bool particle::_debug = false;
49 
50 
53  _spinProj (0),
54  _lzVec (),
55  _index (-1),
56  _refl (0)
57 { }
58 
59 
61 {
62  *this = part;
63 }
64 
65 
67  const int index,
68  const int spinProj,
69  const int refl,
70  const TVector3& momentum)
71  : particleProperties(partProp),
72  _spinProj (spinProj),
73  _lzVec (TLorentzVector(momentum, sqrt(momentum.Mag2() + mass() * mass()))),
74  _index (index),
75  _refl (refl)
76 { }
77 
78 
79 particle::particle(const string& partName,
80  const bool requirePartInTable,
81  const int index,
82  const int spinProj,
83  const int refl,
84  const TVector3& momentum)
86  _spinProj(spinProj),
87  _index (index),
88  _refl (refl)
89 {
90  if (not fillFromDataTable(partName, requirePartInTable))
91  // set at least name
92  setName(partName);
93  _lzVec = TLorentzVector(momentum, sqrt(momentum.Mag2() + mass() * mass()));
94 }
95 
96 
97 particle::particle(const string& partName,
98  const int isospin,
99  const int G,
100  const int J,
101  const int P,
102  const int C,
103  const int spinProj,
104  const int refl,
105  const int index)
106  : particleProperties(partName, isospin, G, J, P, C),
107  _spinProj(spinProj),
108  _index (index),
109  _refl (refl)
110 { }
111 
112 
114 { }
115 
116 
117 particle&
119 {
120  if (this != &part) {
122  _spinProj = part._spinProj;
123  _lzVec = part._lzVec;
124  _index = part._index;
125  _refl = part._refl;
126  }
127  return *this;
128 }
129 
130 
131 particle*
133 {
134  particle* particleClone(new particle(*this));
135  if (_debug)
136  printDebug << "cloned " << *this << "; " << this << " -> " << particleClone << endl;
137  return particleClone;
138 }
139 
140 
141 bool
143 {
144  const particle* part = dynamic_cast<const particle*>(&partProp);
145  if (not part)
146  return false;
147  if (not particleProperties::isEqualTo(partProp))
148  return false;
149  return ( (spinProj () == part->spinProj ())
150  and (index () == part->index ())
151  and (reflectivity() == part->reflectivity()));
152 }
153 
154 
155 void
157 {
158  if (this != &prop)
160 }
161 
162 
163 string
165 {
166  ostringstream out;
167  out << name() << "[" << spinQn(isospin()) << parityQn(G())
168  << "(" << spinQn(J()) << parityQn(P()) << parityQn(C()) << ")"
169  << spinQn(spinProj()) << parityQn(reflectivity()) << "]";
170  return out.str();
171 }
172 
173 
174 ostream&
175 particle::print(ostream& out) const
176 {
178  out << ", "
179  << "spin proj. = " << spinQn(_spinProj) << ", "
180  << "reflectivity = " << _refl << ", "
181  << "Lorentz-vector = " << _lzVec << " GeV, "
182  << "index = " << _index;
183  return out;
184 }
185 
186 
187 string
189 {
190  ostringstream out;
191  out << name() << "[" << spinQn(isospin()) << parityQn(G())
192  << "(" << spinQn(J()) << parityQn(P()) << parityQn(C()) << ")]";
193  return out.str();
194 }