Something went wrong on our end
-
Bertram Kopf authored51d6a990
FlatteDynamics.cc 3.26 KiB
// FlatteDynamics class definition file. -*- C++ -*-
// Copyright 2013 Bertram Kopf
#include <getopt.h>
#include <fstream>
#include <string>
#include <mutex>
#include <boost/algorithm/string.hpp>
#include "PwaUtils/FlatteDynamics.hh"
#include "ErrLogger/ErrLogger.hh"
#include "Particle/Particle.hh"
#include "PwaDynamics/Flatte.hh"
#include "Utils/FunctionUtils.hh"
FlatteDynamics::FlatteDynamics(std::string& key, std::vector<Particle*>& fsParticles, Particle* mother, std::pair<Particle*, Particle*>& decPair1stChannel, std::pair<Particle*, Particle*>& decPair2ndChannel) :
AbsDynamics(key, fsParticles, mother)
,_g11Key(_massKey+decPair1stChannel.first->name()+decPair1stChannel.second->name())
,_g22Key(_massKey+decPair2ndChannel.first->name()+decPair2ndChannel.second->name())
{
std::string firstPair1stPartStr=decPair1stChannel.first->name();
boost::replace_all(firstPair1stPartStr,"+", "");
boost::replace_all(firstPair1stPartStr,"-", "");
std::string firstPair2ndPartStr=decPair1stChannel.second->name();
boost::replace_all(firstPair2ndPartStr,"+", "");
boost::replace_all(firstPair2ndPartStr,"-", "");
_g11Key=_massKey+firstPair1stPartStr+firstPair2ndPartStr;
std::string secondPair1stPartStr=decPair2ndChannel.first->name();
boost::replace_all(secondPair1stPartStr,"+", "");
boost::replace_all(secondPair1stPartStr,"-", "");
std::string secondPair2ndPartStr=decPair2ndChannel.second->name();
boost::replace_all(secondPair2ndPartStr,"+", "");
boost::replace_all(secondPair2ndPartStr,"-", "");
_g22Key=_massKey+secondPair1stPartStr+secondPair2ndPartStr;
_flattePtr=boost::shared_ptr<Flatte>(new Flatte(decPair1stChannel, decPair2ndChannel));
}
FlatteDynamics::~FlatteDynamics()
{
}
complex<double> FlatteDynamics::eval(EvtData* theData, AbsXdecAmp* grandmaAmp, Spin OrbMom){
int evtNo=theData->evtNo;
if ( _cacheAmps && !_recalculate){
return _cachedMap[evtNo];
}
complex<double> result=_flattePtr->calcFirstChannel(theData->FourVecsString[_dynKey].M(), _currentMass, _currentg11, _currentg22);
if ( _cacheAmps){
theMutex.lock();
_cachedMap[evtNo]=result;
theMutex.unlock();
}
return result;
}
void FlatteDynamics::getDefaultParams(fitParams& fitVal, fitParams& fitErr){
fitVal.Masses[_massKey]=_mother->mass();
fitErr.Masses[_massKey]=0.03;
fitVal.gFactors[_g11Key]=1.;
fitErr.gFactors[_g11Key]=1.;
fitVal.gFactors[_g22Key]=1.;
fitErr.gFactors[_g22Key]=1.;
}
bool FlatteDynamics::checkRecalculation(fitParams& theParamVal){
_recalculate=false;
double mass=theParamVal.Masses[_massKey];
if ( fabs(mass-_currentMass) > 1.e-10){
_recalculate=true;
}
double g11=theParamVal.gFactors[_g11Key];
if ( fabs(g11-_currentg11) > 1.e-10){
_recalculate=true;
}
double g22=theParamVal.gFactors[_g22Key];
if ( fabs(g22-_currentg22) > 1.e-10){
_recalculate=true;
}
return _recalculate;
}
void FlatteDynamics::updateFitParams(fitParams& theParamVal){
_currentMass=theParamVal.Masses[_massKey];
_currentg11=theParamVal.gFactors[_g11Key];
_currentg22=theParamVal.gFactors[_g22Key];
}
void FlatteDynamics::setMassKey(std::string& theMassKey){
boost::replace_all(_g11Key,_massKey, theMassKey);
boost::replace_all(_g22Key,_massKey, theMassKey);
AbsDynamics::setMassKey(theMassKey);
}