CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtDecayMode.cc
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// File and Version Information:
3// $Id: EvtDecayMode.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
4//
5// Environment:
6// This software is part of the EvtGen package developed jointly
7// for the BaBar and CLEO collaborations. If you use all or part
8// of it, please give an appropriate acknowledgement.
9//
10// Copyright Information:
11// Copyright (C) 1998 Caltech, UCSB
12//
13// Module creator:
14// Alexei Dvoretskii, Caltech, 2001-2002.
15//-----------------------------------------------------------------------
17
18// Parses a decay string to identify the name
19// of the mother and of the daughters. The string should
20// be in standard format e.g. "B+ -> pi+ pi+ pi-"
21
23#include <assert.h>
24#include <iostream>
27using std::endl;
28using std::ostream;
29
30using std::string;
31using std::vector;
32
33
34EvtDecayMode::EvtDecayMode(std::string mother,vector<string> dau)
35 : _mother(mother)
36{
37 unsigned i;
38 for(i=0;i<dau.size();i++) {
39
40 string s;
41 s.append(dau[i]);
42 _dau.push_back(s);
43 }
44}
45
46
48 : _mother(other._mother)
49{
50 unsigned i;
51 for(i=0;i<other._dau.size();i++) {
52
53 string s;
54 s.append(other._dau[i]);
55 _dau.push_back(s);
56 }
57}
58
59
61{
62 // Parse the decay string, it should be in a standard
63 // format, e.g. "B+ -> pi+ pi+ pi-" with all spaces
64
65 string s(decay);
66 size_t i,j;
67
68 // mother
69
70 i = s.find_first_not_of(" ");
71 j = s.find_first_of(" ",i);
72
73 if(i == string::npos) {
74
75 report(INFO,"EvtGen") << "No non-space character found" << endl;
76 assert(0);
77 }
78
79 if(j == string::npos) {
80
81 report(INFO,"EvtGen") << "No space before -> found" << endl;
82 assert(0);
83 }
84
85 _mother = string(s,i,j-i);
86
87 i = s.find_first_not_of(" ",j);
88 j = s.find_first_of("->",j);
89 if(i != j) {
90
91 report(INFO,"EvtGen") << "Multiple mothers?" << i << "," << j << endl;
92 assert(0);
93 }
94 j += 2;
95
96 while(1) {
97
98 i = s.find_first_not_of(" ",j);
99 j = s.find_first_of(" ",i);
100
101 if(i == string::npos) break;
102 if(j == string::npos) {
103 _dau.push_back(string(s,i,s.size()-i+1));
104 break;
105 } else {
106 _dau.push_back(string(s,i,j-i));
107 }
108 }
109}
110
111
112
114{}
115
116
117const char* EvtDecayMode::mother() const
118{
119 return _mother.c_str();
120}
121
122
124{
125 return _dau.size();
126}
127
128
129const char* EvtDecayMode::dau(int i) const
130{
131 assert(0<=i && i< (int) _dau.size());
132 return _dau[i].c_str();
133}
134
135const char* EvtDecayMode::mode() const
136{
137 string ret = _mother + string(" -> ");
138 int i;
139 for(i=0;i<_dau.size()-1;i++) ret += string(_dau[i]) + string(" ");
140 ret += _dau[_dau.size()-1];
141 return ret.c_str();
142}
143
144
145ostream& EvtDecayMode::print(ostream& os) const
146{
147 os << _mother.c_str() << " ->";
148 unsigned i;
149 for(i=0;i<_dau.size();i++) os << " " << _dau[i].c_str();
150 return os;
151}
152
153
155{
156 string s("m(");
157 s.append(dau(first(i)));
158 s.append(",");
159 s.append(dau(second(i)));
160 s.append(")");
161 return s.c_str();
162}
163
164
166{
167 string s("q(");
168 s.append(dau(first(i)));
169 s.append(",");
170 s.append(dau(second(i)));
171 s.append(")");
172 return s.c_str();
173}
174
175
177{
178 string s(q(i));
179 s.append(":");
180 s.append(q(j));
181 return s.c_str();
182}
183
184
185ostream& operator<<(ostream& os, const EvtDecayMode& mode)
186{
187 mode.print(os);
188 return os;
189}
ostream & operator<<(ostream &os, const EvtDecayMode &mode)
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ INFO
Definition: EvtReport.hh:52
XmlRpcServer s
Definition: HelloServer.cpp:11
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition: KKsem.h:33
const char * dal(EvtCyclic3::Pair i, EvtCyclic3::Pair j) const
const char * mother() const
const char * mode() const
EvtDecayMode(const char *decay)
Definition: EvtDecayMode.cc:60
int nD() const
const char * dau(int i) const
const char * q(EvtCyclic3::Pair i) const
std::ostream & print(std::ostream &) const
const char * m(EvtCyclic3::Pair i) const