Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//************************************************************************//
// //
// Copyright 2013 Bertram Kopf (bertram@ep1.rub.de) //
// Julian Pychy (julian@ep1.rub.de) //
// - Ruhr-Universität Bochum //
// //
// This file is part of Pawian. //
// //
// Pawian is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Pawian is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Pawian. If not, see <http://www.gnu.org/licenses/>. //
// //
//************************************************************************//
// TensorOmegaTo3PiDecAmps class definition file. -*- C++ -*-
// Copyright 2012 Bertram Kopf
#include <getopt.h>
#include <fstream>
#include <string>
#include <mutex>
#include "PwaUtils/TensorOmegaTo3PiDecAmps.hh"
#include "qft++/relativistic-quantum-mechanics/Utils.hh"
#include "ErrLogger/ErrLogger.hh"
#include "PwaUtils/DataUtils.hh"
#include "PwaUtils/OmegaTo3PiTensorDecay.hh"
#include "Particle/Particle.hh"
TensorOmegaTo3PiDecAmps::TensorOmegaTo3PiDecAmps(boost::shared_ptr<OmegaTo3PiTensorDecay> theDec) :
AbsXdecAmp(theDec)
,_JPCLSs(theDec->JPCLSAmps())
,_factorMag(1.)
{
if(_JPCLSs.size()>0) _factorMag=1./sqrt(_JPCLSs.size());
_daughter1=_decay->daughter1Part();
_daughter2=_decay->daughter2Part();
_daughter3=theDec->daughter3Part();
}
TensorOmegaTo3PiDecAmps::~TensorOmegaTo3PiDecAmps()
{
}
complex<double> TensorOmegaTo3PiDecAmps::XdecPartAmp(Spin lamX, Spin lamDec, short fixDaughterNr, EvtData* theData, Spin lamFs, AbsXdecAmp* grandmaAmp){
complex<double> result(0.,0.);
// std::vector< boost::shared_ptr<const JPCLS> >::iterator it;
// for (it=_JPCLSs.begin(); it!=_JPCLSs.end(); ++it){
// if( fabs(lamX) > (*it)->J ) continue;
// double theMag=_currentParamMags[*it];
// double thePhi=_currentParamPhis[*it];
// complex<double> expi(cos(thePhi), sin(thePhi));
// complex<double> amp = theMag*expi*sqrt(2*(*it)->L+1)
// *conj( theData->WignerDsString[_wignerDKey][(*it)->J][lamX][0]);
// result+=amp;
// }
return result;
}
complex<double> TensorOmegaTo3PiDecAmps::XdecAmp(Spin lamX, EvtData* theData, Spin lamFs, AbsXdecAmp* grandmaAmp){
complex<double> result(0.,0.);
int evtNo=theData->evtNo;
if ( _cacheAmps && !_recalculate){
result=_cachedAmpMap[evtNo][lamX][lamFs];
return result;
}
// Vector4<double> part1_4Vec=theData->FourVecsString[_daughter1->name()];
// Vector4<double> part2_4Vec=theData->FourVecsString[_daughter2->name()];
// Vector4<double> part3_4Vec=theData->FourVecsString[_daughter3->name()];
// Vector4<double> P_2part_4Vec=part1_4Vec+part2_4Vec+part3_4Vec;
// LeviCivitaTensor eps;
// PolVector omega; // spin-1 particle is the default constructor
// omega.SetP4(P_2part_4Vec, P_2part_4Vec.M());
std::vector< boost::shared_ptr<const JPCLS> >::iterator it;
for (it=_JPCLSs.begin(); it!=_JPCLSs.end(); ++it){
if( fabs(lamX) > (*it)->J ) continue;
double theMag=_currentParamMags[*it];
double thePhi=_currentParamPhis[*it];
complex<double> expi(cos(thePhi), sin(thePhi));
// Tensor<complex<double> > ampTensor(0);
// ampTensor = eps|(part1_4Vec%part2_4Vec%part3_4Vec%omega(lamX));
complex<double> amp = theMag*expi*theData->ComplexDoubleString["omegTensor"][_JPCPtr->J][lamX];
// Info << "amp:\t" << amp << endmsg;
result+=amp;
}
if ( _cacheAmps){
theMutex.lock();
_cachedAmpMap[evtNo][lamX][lamFs]=result;
theMutex.unlock();
}
result*=_absDyn->eval(theData, grandmaAmp);
return result;
}
void TensorOmegaTo3PiDecAmps::print(std::ostream& os) const{
return; //dummy
}
void TensorOmegaTo3PiDecAmps::getDefaultParams(fitParams& fitVal, fitParams& fitErr){
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess > currentMagValMap;
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess > currentPhiValMap;
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess > currentMagErrMap;
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess > currentPhiErrMap;
std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itLS;
for(itLS=_JPCLSs.begin(); itLS!=_JPCLSs.end(); ++itLS){
currentMagValMap[*itLS]=_factorMag;
currentPhiValMap[*itLS]=0.;
currentMagErrMap[*itLS]=_factorMag;
currentPhiErrMap[*itLS]=0.3;
}
fitVal.Mags[_key]=currentMagValMap;
fitVal.Phis[_key]=currentPhiValMap;
fitErr.Mags[_key]=currentMagErrMap;
fitErr.Phis[_key]=currentPhiErrMap;
_absDyn->getDefaultParams(fitVal, fitErr);
if(!_daughter1IsStable) _decAmpDaughter1->getDefaultParams(fitVal, fitErr);
if(!_daughter2IsStable) _decAmpDaughter2->getDefaultParams(fitVal, fitErr);
}
bool TensorOmegaTo3PiDecAmps::checkRecalculation(fitParams& theParamVal){
_recalculate=false;
if(_absDyn->checkRecalculation(theParamVal)) _recalculate=true;
if(!_daughter1IsStable) {
if(_decAmpDaughter1->checkRecalculation(theParamVal)) _recalculate=true;
}
if(!_daughter2IsStable){
if(_decAmpDaughter2->checkRecalculation(theParamVal)) _recalculate=true;
}
if(!_recalculate){
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess >& magMap=theParamVal.Mags[_key];
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess >& phiMap=theParamVal.Phis[_key];
std::vector< boost::shared_ptr<const JPCLS> >::iterator it;
for (it=_JPCLSs.begin(); it!=_JPCLSs.end(); ++it){
double theMag=magMap[*it];
double thePhi=phiMap[*it];
if(!CheckDoubleEquality(theMag, _currentParamMags[*it])){
_recalculate=true;
return _recalculate;
}
if(!CheckDoubleEquality(thePhi, _currentParamPhis[*it])){
_recalculate=true;
return _recalculate;
}
}
}
return _recalculate;
}
void TensorOmegaTo3PiDecAmps::updateFitParams(fitParams& theParamVal){
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess >& magMap=theParamVal.Mags[_key];
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess >& phiMap=theParamVal.Phis[_key];
std::vector< boost::shared_ptr<const JPCLS> >::iterator it;
for (it=_JPCLSs.begin(); it!=_JPCLSs.end(); ++it){
double theMag=magMap[*it];
double thePhi=phiMap[*it];
_currentParamMags[*it]=theMag;
_currentParamPhis[*it]=thePhi;
}
_absDyn->updateFitParams(theParamVal);
if(!_daughter1IsStable) _decAmpDaughter1->updateFitParams(theParamVal);
if(!_daughter2IsStable) _decAmpDaughter2->updateFitParams(theParamVal);
}