Newer
Older
#include <getopt.h>
#include <fstream>
#include <string>
#include "Examples/Psi2SToKpKmPiGam/Psi2SToKpKmPiGamBaseLh.hh"
#include "Examples/Psi2SToKpKmPiGam/Psi2SToKpKmPiGamEventList.hh"
#include "ErrLogger/ErrLogger.hh"
Psi2SToKpKmPiGamBaseLh::Psi2SToKpKmPiGamBaseLh(boost::shared_ptr<const Psi2SToKpKmPiGamEventList> theEvtList, const std::map<const std::string, bool>& hypMap) :
AbsPsi2SToKpKmPiGamLh(theEvtList)
,_K0_1430Hyp(true)
,_K1_1410Hyp(true)
,_K2_1430Hyp(true)
,_nFitParams(0)
{
std::map<const std::string, bool>::const_iterator iter= hypMap.find("K0_1430HypBase");
if (iter !=hypMap.end()){
_K0_1430Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K0_1430Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K0_1430HypBase not set!!!" <<endmsg;
iter= hypMap.find("K1_1410HypBase");
if (iter !=hypMap.end()){
_K1_1410Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K1_1410Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K1_1410HypBase not set!!!" <<endmsg;
iter= hypMap.find("K2_1430HypBase");
if (iter !=hypMap.end()){
_K2_1430Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K2_1430Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K2_1430HypBase not set!!!" <<endmsg;
iter= hypMap.find("KKPi_HypBase");
if (iter !=hypMap.end()){
_KKPi_Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _KKPi_Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis KKPi_HypBase not set!!!" <<endmsg;
_ampVec.push_back(paramEnumKpKmPiGam::ChiGam);
_ampVec.push_back(paramEnumKpKmPiGam::K890K);
if(_K0_1430Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_0_1400K);
if(_K1_1410Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_1_1400K);
if(_K2_1430Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_2_1400K);
if(_KKPi_Hyp) _ampVec.push_back(paramEnumKpKmPiGam::KKPi);
_ampVec.push_back(paramEnumKpKmPiGam::a980Pi);
_massVec.push_back(paramEnumKpKmPiGam::K890);
if(_K0_1430Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_0_1400);
if(_K1_1410Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_1_1400);
if(_K2_1430Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_2_1400);
std::vector<unsigned int>::iterator ampIt;
for (ampIt=_ampVec.begin(); ampIt!=_ampVec.end(); ++ampIt){
std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParamsKpKmPiGam.jpclsVec(*ampIt);
_nFitParams+=2*JPCLSs.size();
}
std::vector<unsigned int>::iterator massIt;
for (massIt=_massVec.begin(); massIt!=_massVec.end(); ++massIt){
_nFitParams+=2;
}
_nFitParams+=3; //a(980) Flatte parameters
_nFitParams+=1; //phase space
}
Psi2SToKpKmPiGamBaseLh::Psi2SToKpKmPiGamBaseLh( boost::shared_ptr<AbsPsi2SToKpKmPiGamLh> theLhPtr, const std::map<const std::string, bool>& hypMap ) :
AbsPsi2SToKpKmPiGamLh(theLhPtr->getEventList())
,_K0_1430Hyp(true)
,_K1_1410Hyp(true)
,_K2_1430Hyp(true)
,_nFitParams(0)
{
std::map<const std::string, bool>::const_iterator iter= hypMap.find("K0_1430HypBase");
if (iter !=hypMap.end()){
_K0_1430Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K0_1430Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K0_1430HypBase not set!!!" <<endmsg;
iter= hypMap.find("K1_1410HypBase");
if (iter !=hypMap.end()){
_K1_1410Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K1_1410Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K1_1410HypBase not set!!!" <<endmsg;
iter= hypMap.find("K2_1430HypBase");
if (iter !=hypMap.end()){
_K2_1430Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _K2_1430Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis K2_1430HypBase not set!!!" <<endmsg;
iter= hypMap.find("KKPi_HypBase");
if (iter !=hypMap.end()){
_KKPi_Hyp= iter->second;
Info<< "hypothesis " << iter->first << "\t" << _KKPi_Hyp <<endmsg;
_hypMap[iter->first]= iter->second;
}
else Alert << "hypothesis KKPi_HypBase not set!!!" <<endmsg;
_ampVec.push_back(paramEnumKpKmPiGam::ChiGam);
_ampVec.push_back(paramEnumKpKmPiGam::K890K);
if(_K0_1430Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_0_1400K);
if(_K1_1410Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_1_1400K);
if(_K2_1430Hyp) _ampVec.push_back(paramEnumKpKmPiGam::K_2_1400K);
if(_KKPi_Hyp) _ampVec.push_back(paramEnumKpKmPiGam::KKPi);
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
_ampVec.push_back(paramEnumKpKmPiGam::a980Pi);
_massVec.push_back(paramEnumKpKmPiGam::K890);
if(_K0_1430Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_0_1400);
if(_K1_1410Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_1_1400);
if(_K2_1430Hyp) _massVec.push_back(paramEnumKpKmPiGam::K_2_1400);
std::vector<unsigned int>::iterator ampIt;
for (ampIt=_ampVec.begin(); ampIt!=_ampVec.end(); ++ampIt){
std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParamsKpKmPiGam.jpclsVec(*ampIt);
_nFitParams+=2*JPCLSs.size();
}
std::vector<unsigned int>::iterator massIt;
for (massIt=_massVec.begin(); massIt!=_massVec.end(); ++massIt){
_nFitParams+=2;
}
_nFitParams+=3; //a(980) Flatte parameters
_nFitParams+=1; //phase space parameter
}
Psi2SToKpKmPiGamBaseLh::~Psi2SToKpKmPiGamBaseLh()
{;
}
complex<double> Psi2SToKpKmPiGamBaseLh::calcCoherentAmp(Spin Minit, Spin lamGam, const paramKpKmPiGam& theParamVal, Psi2SToKpKmPiGamData::Psi2SToKpKmPiGamEvtData* theData){
complex<double> result(0.,0.);
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > PsiToChiGam=theParamVal.PsiToChiGam;
for (Spin lamChi=-1; lamChi<=1; lamChi++){
Spin lamChiGam=lamChi-lamGam;
complex<double> PsiDecAmp=conj(theData->dfPsi[1][Minit][lamChiGam]);
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
complex<double> PsiDecAmpTmpls(0.,0.);
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess >::iterator itPsi;
for ( itPsi=PsiToChiGam.begin(); itPsi!=PsiToChiGam.end(); ++itPsi){
boost::shared_ptr<const JPCLS> PsiState=itPsi->first;
if (fabs(lamChiGam)>PsiState->J || fabs(lamChiGam)>PsiState->S) continue;
double thePsiMag=itPsi->second.first;
double thePsiPhi=itPsi->second.second;
complex<double> expiphiPsi(cos(thePsiPhi), sin(thePsiPhi));
complex<double> dummyAmp(0.,0.);
complex<double> decAmp=calcDecAmp(dummyAmp, lamChi, theParamVal, theData);
PsiDecAmpTmpls+=thePsiMag*expiphiPsi*sqrt(2*PsiState->L+1)
*Clebsch(PsiState->L,0,PsiState->S,lamChiGam,PsiState->J,lamChiGam)
*Clebsch(1, lamChi, 1, -lamGam, PsiState->S,lamChiGam)
*decAmp;
}
PsiDecAmp*=PsiDecAmpTmpls;
result+=PsiDecAmp;
}
return result;
}
complex<double> Psi2SToKpKmPiGamBaseLh::calcDecAmp(complex<double>& inAmp,Spin lamChi, const paramKpKmPiGam& theParamVal, Psi2SToKpKmPiGamData::Psi2SToKpKmPiGamEvtData* theData){
complex<double> result=inAmp;
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToK890K=theParamVal.ChiToK890K;
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToa0Pi=theParamVal.ChiToa0Pi;
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToKKPi=theParamVal.ChiToKKPi;
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
double K890Mass=theParamVal.BwK890.first;
double K890Width=theParamVal.BwK890.second;
double a980FlatteMass=theParamVal.FlatMa980;
double a980FlatgKK=theParamVal.FlatgKK;
double a980FlatgEtaPi=theParamVal.FlatgEtaPi;
//Chi to a0(980) pi0 and a0(980)->K+K-
result+=a980FlatteAmp(theData, ChiToa0Pi, a980FlatteMass, a980FlatgKK, a980FlatgEtaPi, lamChi);
//Chi -> K890 K and K890->K pi0
result+=K892Amp(theData, ChiToK890K, K890Mass, K890Width, lamChi);
//Chi -> K_0_1400 K and K_0_1400->K pi0
if(_K0_1430Hyp){
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToK_0_1400K=theParamVal.ChiToK1400_0_K;
double K_0_1400Mass=theParamVal.BwK1400_0.first;
double K_0_1400Width=theParamVal.BwK1400_0.second;
result+=K0_1400Amp(theData, ChiToK_0_1400K, K_0_1400Mass, K_0_1400Width, lamChi);
}
//Chi -> K_1_1400 K and K_1_1400->K pi0
if(_K1_1410Hyp){
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToK_1_1400K=theParamVal.ChiToK1400_1_K;
double K_1_1400Mass=theParamVal.BwK1400_1.first;
double K_1_1400Width=theParamVal.BwK1400_1.second;
result+=K1_1400Amp(theData, ChiToK_1_1400K, K_1_1400Mass, K_1_1400Width, lamChi);
}
//Chi -> K_2_1400 K and K_2_1400->K pi0
if(_K2_1430Hyp){
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToK_2_1400K=theParamVal.ChiToK1400_2_K;
double K_2_1400Mass=theParamVal.BwK1400_2.first;
double K_2_1400Width=theParamVal.BwK1400_2.second;
result+=K2_1400Amp(theData, ChiToK_2_1400K, K_2_1400Mass, K_2_1400Width, lamChi);
}
//Chi -> K+ K- pi0
if(_KKPi_Hyp){
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiToKKPi=theParamVal.ChiToKKPi;
result+=KKPi_Amp(theData, ChiToKKPi, lamChi);
}
return result;
}
void Psi2SToKpKmPiGamBaseLh::setMnUsrParams(MnUserParameters& upar, paramKpKmPiGam& startVal, paramKpKmPiGam& errVal){
_fitParamsKpKmPiGam.setMnUsrParamsFlattea980Mass(upar, startVal, errVal, paramEnumKpKmPiGam::name(paramEnumKpKmPiGam::phaseSpace));
_fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal,paramEnumKpKmPiGam::ChiGam);
_fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::K890K);
if(_K0_1430Hyp) _fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::K_0_1400K);
if(_K1_1410Hyp) _fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::K_1_1400K);
if(_K2_1430Hyp) _fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::K_2_1400K);
if(_KKPi_Hyp) _fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::KKPi);
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
_fitParamsKpKmPiGam.setMnUsrParamsDec(upar,startVal,errVal, paramEnumKpKmPiGam::a980Pi);
//K*(982) BW
_fitParamsKpKmPiGam.setMnUsrParamsMass(upar, startVal, errVal, paramEnumKpKmPiGam::K890);
//K*(1400) BWs
if(_K0_1430Hyp) _fitParamsKpKmPiGam.setMnUsrParamsMass(upar, startVal, errVal, paramEnumKpKmPiGam::K_0_1400);
if(_K1_1410Hyp) _fitParamsKpKmPiGam.setMnUsrParamsMass(upar, startVal, errVal, paramEnumKpKmPiGam::K_1_1400);
if(_K2_1430Hyp) _fitParamsKpKmPiGam.setMnUsrParamsMass(upar, startVal, errVal, paramEnumKpKmPiGam::K_2_1400);
//a(980) BW
// setMnUsrParamsMass(upar, startVal, errVal, paramEnumKpKmPiGam::a980");
_fitParamsKpKmPiGam.setMnUsrParamsFlattea980Mass(upar, startVal, errVal, paramEnumKpKmPiGam::name(paramEnumKpKmPiGam::a980));
}
int Psi2SToKpKmPiGamBaseLh::setFitParamVal(paramKpKmPiGam& theParamVal, const std::vector<double>& par) {
if (par.size()!= nFitParams() ) {
Alert << "size of parameters wrong!!! par.size()=" << par.size() <<
"\t it should be" << nFitParams() << endmsg;
exit(1);
}
std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS;
int counter=0;
counter=_fitParamsKpKmPiGam.setFitParamFlattea980Mass(theParamVal, par, counter, paramEnumKpKmPiGam::name(paramEnumKpKmPiGam::phaseSpace));
//Psi(2S) ->Chi_c1 gamma amplitude params
counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::ChiGam);
//K*(982) amplitude params
counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::K890K);
//K*(1400)_1 amplitude params
if(_K0_1430Hyp) counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::K_0_1400K);
if(_K1_1410Hyp) counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::K_1_1400K);
if(_K2_1430Hyp) counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::K_2_1400K);
if(_KKPi_Hyp) counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::KKPi);
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
//a(980) amplitude params
counter=_fitParamsKpKmPiGam.setFitParamValDec(theParamVal, par, counter, paramEnumKpKmPiGam::a980Pi);
// K890 mass
counter=_fitParamsKpKmPiGam.setFitParamValMass(theParamVal, par, counter, paramEnumKpKmPiGam::K890);
// K1400 masses
if(_K0_1430Hyp) counter=_fitParamsKpKmPiGam.setFitParamValMass(theParamVal, par, counter, paramEnumKpKmPiGam::K_0_1400);
if(_K1_1410Hyp) counter=_fitParamsKpKmPiGam.setFitParamValMass(theParamVal, par, counter, paramEnumKpKmPiGam::K_1_1400);
if(_K2_1430Hyp) counter=_fitParamsKpKmPiGam.setFitParamValMass(theParamVal, par, counter, paramEnumKpKmPiGam::K_2_1400);
// a(980) mass
// counter=setFitParamValMass(theParamVal, par, counter, paramEnumKpKmPiGam::a980);
counter=_fitParamsKpKmPiGam.setFitParamFlattea980Mass(theParamVal, par, counter, paramEnumKpKmPiGam::name(paramEnumKpKmPiGam::a980));
return counter;
}
unsigned int Psi2SToKpKmPiGamBaseLh::nFitParams(){
return _nFitParams;
}
void Psi2SToKpKmPiGamBaseLh::print(std::ostream& os) const{
os << "Psi2SToKpKmPiGamBaseLh::print\n";
}
void Psi2SToKpKmPiGamBaseLh::printCurrentFitResult(paramKpKmPiGam& theParamVal) {
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
DebugMsg<< "phaseSpace: " << theParamVal.phaseSpace << endmsg;
std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS;
std::vector<unsigned int>::const_iterator itAmps;
for ( itAmps=_ampVec.begin(); itAmps!=_ampVec.end(); ++itAmps){
std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParamsKpKmPiGam.jpclsVec(*itAmps);
for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){
DebugMsg<< (*itJPCLS)->name()<< paramEnumKpKmPiGam::name(*itAmps) << endmsg;
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMap=_fitParamsKpKmPiGam.ampMap(theParamVal, *itAmps);
std::pair<double, double> tmpParam=currentMap[(*itJPCLS)];
DebugMsg <<"\t mag:" << tmpParam.first <<"\t phi:" << tmpParam.second << endmsg;
}
}
std::vector<unsigned int>::const_iterator itMasses;
for ( itMasses=_massVec.begin(); itMasses!=_massVec.end(); ++itMasses){
DebugMsg<< paramEnumKpKmPiGam::name(*itMasses) << endmsg;
std::pair<double, double> tmpParam=_fitParamsKpKmPiGam.massPair(theParamVal, *itMasses);
DebugMsg <<"\t mag:" << tmpParam.first <<"\t phi:" << tmpParam.second << endmsg;
}
DebugMsg<< "a980:" << endmsg;
DebugMsg <<"\t mass:" << theParamVal.FlatMa980 <<"\t gKK:" << theParamVal.FlatgKK << "\t gEtaPi:" << theParamVal.FlatgEtaPi << endmsg;
}
void Psi2SToKpKmPiGamBaseLh::dumpCurrentResult(std::ostream& os, paramKpKmPiGam& theParamVal, std::string& suffix){
if ( suffix.compare("Val") != 0 && suffix.compare("Err") !=0 ){
Warning << "suffix " << suffix << " not supported!!! Use Val or Err" << endmsg;
return;
}
std::string tmpStringPs="phaseSpace"+suffix;
os << tmpStringPs << "\t" << theParamVal.phaseSpace << "\t" << 0. << std::endl;
std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS;
std::vector<unsigned int>::const_iterator itAmps;
for ( itAmps=_ampVec.begin(); itAmps!=_ampVec.end(); ++itAmps){
std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParamsKpKmPiGam.jpclsVec(*itAmps);
for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){
std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMap=_fitParamsKpKmPiGam.ampMap(theParamVal, *itAmps);
std::pair<double, double> tmpParam=currentMap[(*itJPCLS)];
std::string tmpStringDec=(*itJPCLS)->name()+paramEnumKpKmPiGam::name(*itAmps)+suffix;
os << tmpStringDec << "\t" << tmpParam.first << "\t" << tmpParam.second << std::endl;
}
}
std::vector<unsigned int>::const_iterator itMasses;
for ( itMasses=_massVec.begin(); itMasses!=_massVec.end(); ++itMasses){
std::string tmpStringMass=paramEnumKpKmPiGam::name(*itMasses)+suffix;
std::pair<double, double> tmpParam=_fitParamsKpKmPiGam.massPair(theParamVal, *itMasses);
os << tmpStringMass << "\t" << tmpParam.first << "\t" << tmpParam.second << std::endl;
}
std::string tmpStringFlat="FlatMa980"+suffix;
os << tmpStringFlat << "\t" << theParamVal.FlatMa980 << "\t" << 0. << std::endl;
tmpStringFlat="FlatgKK"+suffix;
os << tmpStringFlat << "\t" << theParamVal.FlatgKK << "\t" << 0. << std::endl;
tmpStringFlat="FlatgEtaPi"+suffix;
os << tmpStringFlat << "\t" << theParamVal.FlatgEtaPi << "\t" << 0. << std::endl;
}