9 #include "reportingUtils.hpp"
17 partialWaveWeight::addWave(
const std::string& keyfilename,
19 const std::complex<double>& branching,
23 if(vectori <= m_waves.size()) {
24 m_waves.resize(vectori+1);
25 m_amps.resize(vectori+1);
26 m_branchings.resize(vectori+1);
27 m_gamp.resize(vectori+1);
31 if(keyfilename.find(
"+-",7) != string::npos) {
32 cerr <<
"Decomposing " << keyfilename << endl;
33 cerr <<
"What is the relative phase (0 or pi)?:";
36 if(keyfilename.find(
"f11285",7) != string::npos) {
37 m_relphase[keyfilename] = -1;
39 m_relphase[keyfilename] = 1;
43 TString name(keyfilename.c_str());
44 int pos = name.Last(
'/');
45 TString w1a = name(pos+8, name.Length()-pos-8);
47 w1a.ReplaceAll(
"+-",
"+");
48 w1a.ReplaceAll(
"-+",
"-");
49 w1a.Prepend(name(0, pos+8));
51 TString w1b = name(pos+8, name.Length()-pos-8);
52 w1b.ReplaceAll(
"+-",
"-");
53 w1b.ReplaceAll(
"-+",
"+");
54 w1b.Prepend(name(0, pos+8));
57 cerr << m_relphase[keyfilename] << endl;
60 m_gamp[vectori].addWave(w1a.Data());
61 m_waves[vectori].push_back(keyfilename);
62 m_branchings[vectori].push_back(branching);
63 m_amps[vectori].push_back(amp);
64 m_gamp[vectori].addWave(w1b.Data());
65 m_waves[vectori].push_back(keyfilename);
66 m_branchings[vectori].push_back(branching);
67 m_amps[vectori].push_back(amp);
70 m_gamp[vectori].addWave(keyfilename);
71 m_waves[vectori].push_back(keyfilename);
72 m_branchings[vectori].push_back(branching);
73 m_amps[vectori].push_back(amp);
80 partialWaveWeight::loadIntegrals(
const std::string& normIntFileName,
double mass) {
83 ifstream intFile(normIntFileName.c_str());
85 printErr <<
"Cannot open file '"
86 << normIntFileName <<
"'. Exiting." << endl;
94 m_normInt[
mass].scan(intFile);
121 partialWaveWeight::prodAmp(
unsigned int iv,
128 std::list<particle>::iterator it = part.begin();
129 while(it != part.end()) {
130 p += (it++)->get4P();
133 return m_amps[iv][iw]->amp(m) * m_branchings[iv][iv];
141 partialWaveWeight::weight(
event& e) {
142 unsigned int nvec = m_waves.size();
149 std::map<double,integral>::iterator it = m_normInt.begin();
151 double closemass = 0;
152 while(it != m_normInt.end()) {
153 double m = it->first;
154 if(fabs(m - mass) < fabs(m - closemass)) {
160 close_int = &(m_normInt[closemass]);
163 for(
unsigned int ivec = 0; ivec < nvec; ++ivec) {
164 std::complex<double> amp(0,0);
165 unsigned int nwaves = m_waves[ivec].size();
166 for(
unsigned int iwaves = 0; iwaves < nwaves; ++iwaves){
167 string w1 = m_waves[ivec][iwaves];
171 w1.erase(0, w1.find_last_of(
"/")+1);
172 w1.replace(w1.find(
".key"), 4,
".amp");
173 std::complex<double> decayamp;
174 decayamp = m_gamp[ivec].Amp(iwaves, e);
176 if(w1.find(
"+-", 7) != string::npos) {
181 decayamp += m_relphase[m_waves[ivec][iwaves]] * m_gamp[ivec].Amp(iwaves, e);
186 nrm = sqrt(close_int->
val(w1, w1).real());
188 amp += (decayamp / nrm) * prodAmp(ivec, iwaves, e);