ROOTPWA
TPDGEntry.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 // File and Version Information:
3 // $Id$
4 //
6 //
7 // Copyright 2009 Sebastian Neubert
8 //
9 // This file is part of rootpwa
10 //
11 // rootpwa is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // rootpwa is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
23 //
25 // Description:
26 // Implementation of class TPDGEntry
27 // see TPDGEntry.h for details
28 //
29 //
30 // Author List:
31 // Sebastian Neubert TUM (original author)
32 //
33 //
34 //-----------------------------------------------------------
35 
36 // This Class' Header ------------------
37 #include "TPDGEntry.h"
38 
39 // C/C++ Headers ----------------------
40 #include <cstdlib>
41 #include <iostream>
42 using std::cout;
43 using std::endl;
44 
45 // Collaborating Class Headers --------
46 
47 
48 // Class Member definitions -----------
49 
51 
52 
53 bool operator== (const TPDGEntry& lhs, const TPDGEntry& rhs)
54 {
55  return lhs.pdgID()==rhs.pdgID();
56 }
57 
58 
59 
60 
61 std::istream& operator>> (std::istream& s, TPDGEntry& me){
62  char delim;
63  char buffer[20];
64 
65  s >> me._mass >>delim>>me. _mass_ep>> delim>> me._mass_en
66  >> delim>> me._width >> delim>> me._width_ep >>delim>> me._width_en>>delim;
67  // read I
68  s.get(buffer,10,',');
69  // analyse isospin
70  if(strpbrk(buffer,"</?")==NULL){ // we have a integer number
71  me._I=atof(buffer);
72  }
73  else if(strpbrk(buffer,"<")!=NULL){ // photon
74  me._I=atof(&(buffer[1]))-1;
75  }
76  else if(strpbrk(buffer,"/")!=NULL){ //
77  double a=atof(buffer);
78  double b=atof(&buffer[2]);
79  if(b!=0)me._I=a/b;
80  else me._I=-1;
81  }
82  else me._I=-1;
83  s >> delim;
84 
85  // read g-Parity
86  char buffer2[20];
87  s.get(buffer2,10,',');
88  // analyse isospin
89  if(strpbrk(buffer2,"+-")==NULL){ // we have a integer number
90  me._G=0;
91  }
92  else if(strpbrk(buffer2,"+")!=NULL){ // photon
93  me._G=1;
94  }
95  else me._G=-1;
96  s >> delim;
97 
98  // read J
99  char buffer3[20];
100  s.get(buffer3,10,',');
101  // analyse isospin
102  if(strpbrk(buffer3,"</?")==NULL){ // we have a integer number
103  me._J=atof(buffer3);
104  }
105  else if(strpbrk(buffer3,"<")!=NULL){ // photon
106  me._J=atof(&(buffer3[1]))-1;
107  }
108  else if(strpbrk(buffer3,"/")!=NULL){ //
109  double a=atof(buffer3);
110  double b=atof(&buffer3[2]);
111  if(b!=0)me._J=a/b;
112  else me._J=-1;
113  }
114  else me._J=-1;
115  s >> delim;
116 
117  // read Parity
118  char buffer4[20];
119  s.get(buffer4,10,',');
120  //cout<< "P:: "<<buffer<<"|"<<endl;
121  // analyse isospin
122  if(strpbrk(buffer4,"+-")==NULL){ // we have a integer number
123  me._P=0;
124  }
125  else if(strpbrk(buffer4,"+")!=NULL){ // photon
126  me._P=1;
127  }
128  else me._P=-1;
129  s >> delim;
130 
131 // read C-Parity
132  char buffer8[20];
133  s.get(buffer8,10,',');
134  //cout<< "C:: "<<buffer<<"|"<<endl;
135  // analyse isospin
136  if(strpbrk(buffer8,"+-")==NULL){ // we have a integer number
137  me._C=0;
138  }
139  else if(strpbrk(buffer8,"+")!=NULL){ // photon
140  me._C=1;
141  }
142  else me._C=-1;
143  s >> delim;
144 
145 
146  // read antiparticle flag
147  char buffer5[20];
148  s.get(buffer5,20,',');
149  if(strpbrk(buffer5,"BF")==NULL){
151  }
152  else if(strpbrk(buffer5,"B")!=NULL){
153  me._aflag = TPDGEntry::B;
154  }
155  else me._aflag = TPDGEntry::F;
156  s >> delim;
157 
158  // read pdg
159  char buffer6[20];
160  s.get(buffer6,20,',');
161  //cout<< "PDG:: "<<buffer<<"|"<<endl;
162  me._pdgID=atoi(buffer6);
163  s >> delim;
164 
165 
166  // read Q
167  char buffer7[20];
168  s.get(buffer7,10,',');
169  if(strpbrk(buffer7,"+-/")==NULL){ // we have a integer number
170  me._q=atof(buffer7);
171  }
172  else if(strpbrk(buffer7,"/")!=NULL){ //
173  double a=atof(buffer7);
174  double b=atof(&buffer7[3]);
175  me._q=a/b;
176  }
177  else if(strpbrk(buffer7,"+")!=NULL){ // photon
178  me._q=1;
179  }
180  else me._q=-1;
181  s >> delim ;
182 
183  char buffer10[20];
184  s.get(buffer10,20,',');
185  if(strpbrk(buffer10,"1234")==NULL){
186  me._R = TPDGEntry::NoBaryon;
187  }
188  else if(strpbrk(buffer10,"4")!=NULL){
189  me._R = TPDGEntry::Certain;
190  }
191  else if(strpbrk(buffer10,"3")!=NULL){
192  me._R = TPDGEntry::Likely;
193  }
194  else if(strpbrk(buffer10,"2")!=NULL){
195  me._R = TPDGEntry::Fair;
196  }
197  else me._R = TPDGEntry::Poor;
198  s >> delim;
199 
200 
201  char buffer9[20];
202  s.get(buffer9,20,',');
203  if(strpbrk(buffer9,"RDSF")==NULL){
205  }
206  else if(strpbrk(buffer9,"R")!=NULL){
208  }
209  else if(strpbrk(buffer9,"D")!=NULL){
211  }
212  else if(strpbrk(buffer9,"S")!=NULL){
214  }
216  s >> delim;
217 
218  s >> me._name >> delim >> me._quark_content;
219  return s;
220 
221 }
222 
223 void
224 TPDGEntry::Print(const Option_t*) const {
225  cout << "---------------------" << endl;
226  cout << "PDG Entry: " << _name << " ID: " << _pdgID << endl;
227  cout << "Q=" << _q << endl;
228  cout << "mass="<<_mass <<" +- ("<<_mass_ep<<","<< _mass_en << ")" << endl;
229  cout << "width="<<_width <<" +- ("<<_width_ep<<","<< _width_en << ")" << endl;
230  cout << "IGJPC="<<Istr()<<Gstr()<<Jstr()<<Pstr()<<Cstr()<<endl;
231  cout << "Quarks: "<<_quark_content<< endl;
232  cout << "Status="<<Statstr() << endl;
233 }
234 
235 
236 TString
237 TPDGEntry::Istr() const {
238  if(_I<0)return "?";
239  TString result;
240  result+=_I;result.ReplaceAll(" ","");
241  return result;
242 }
243 
244 TString
245 TPDGEntry::Gstr() const {
246  if(_G==0)return "?";
247  else if(_G>0) return "+";
248  else return "-";
249 }
250 
251 
252 
253 TString
254 TPDGEntry::Jstr() const {
255  if(_J<0)return "?";
256  TString result;
257  result+=_J;result.ReplaceAll(" ","");
258  return result;
259 }
260 
261 TString
262 TPDGEntry::Pstr() const {
263  if(_P==0)return "?";
264  else if(_P>0) return "+";
265  else return "-";
266 }
267 
268 TString
269 TPDGEntry::Cstr() const {
270  if(_C==0)return "?";
271  else if(_C>0) return "+";
272  else return "-";
273 }
274 
275 TString
276 TPDGEntry::Statstr() const {
277  switch (_status){
278  case Established : {return "Established";}
279  case Omitted : {return "Omitted";}
280  case NeedsConfirmation : {return "Needs Confirmation";}
281  case FurtherMeson : {return "Further Meson";}
282  default : {return "Undefined";}
283  }
284 
285 }
286 
287 
288 bool
289 TPDGEntry::isLightMeson() const {
290  return _R == TPDGEntry::NoBaryon
291  // && !_quark_content.Contains("s")
292 // && !_quark_content.Contains("c")
293 // && !_quark_content.Contains("t")
294 // && !_quark_content.Contains("b")
295 // && !_quark_content.Contains("S")
296 // && !_quark_content.Contains("C")
297 // && !_quark_content.Contains("T")
298 // && !_quark_content.Contains("B")
299  && !_name.Contains("gamma") && !_name.Contains("W") && !_name.Contains("Z")
300  && (_I==0 || _I==1);
301 }
302 
303 bool
304 TPDGEntry::isExotic() const {
305  //cout << _J << (_P>0 ? "+" : "-") << (_C>0 ? "+" : "-") << endl;
306  bool result=false;
307  if(_J==0 && _P==-1 && _C==-1)result=true;
308  else if(((int)_J%2)==0){
309  if(_P==+1 && _C==-1)result=true;
310  }
311  else if(_P==-1 && _C==+1)result=true;
312  if(result)std::cout<< " is exotic!" << endl;
313  return result;
314 }