Skip to content
Snippets Groups Projects
Commit f8fdfae5 authored by Bertram Kopf's avatar Bertram Kopf
Browse files

introduced parameterization for fixing t-matrix poles and widths

parent 017044d1
No related branches found
No related tags found
No related merge requests found
......@@ -61,9 +61,12 @@ KMatrixParser::KMatrixParser(std::string& path)
("useAdler0",po::value<bool>(&_useAdler0), "use adler0 term")
("s0Adler",po::value<double>(&_s0Adler), "s0Adler parameter")
("snormAdler",po::value<double>(&_snormAdler), "snormAdler parameter")
;
("gFactorFixPoles",po::value< vector<string> >(&_gFactorFixPoles), "poles with fixed g-factor ratios, total widths and total mass")
("gFactorFixReleaseGFactor",po::value< vector<string> >(&_gFactorFixReleaseGFactor), "free g-factor for fixing g-factor ratios, total widths and total mass")
("gFactorFixKeepGRatio",po::value< vector<string> >(&_gFactorFixKeepGRatio), "g-factors to be scaled for fixing g-factor ratios, total widths and total mass")
("gFactorFixMassPol",po::value< vector<string> >(&_gFactorFixMassPol), "3rd order polynomial to correct the pole mass for fixing g-factor ratios, total widths and total mass")
("gFactorFixWidthPol",po::value< vector<string> >(&_gFactorFixWidthPol), "3rd order polynomial to correct the pole width for fixing g-factor ratios, total widths and total mass")
;
parseCommandLine();
}
......
......@@ -64,7 +64,12 @@ public:
const bool useAdler() const {return _useAdler0;}
const double s0Adler() const {return _s0Adler;}
const double snormAdler() const {return _snormAdler;}
const std::vector<std::string> gFactorFixPoles() {return _gFactorFixPoles;}
const std::vector<std::string> gFactorFixReleaseGFactor() {return _gFactorFixReleaseGFactor;}
const std::vector<std::string> gFactorFixKeepGRatio() {return _gFactorFixKeepGRatio;}
const std::vector<std::string> gFactorFixMassPol() {return _gFactorFixMassPol;}
const std::vector<std::string> gFactorFixWidthPol() {return _gFactorFixWidthPol;}
protected:
// virtual bool parseCommandLine(int argc,char **argv);
virtual bool parseCommandLine();
......@@ -82,6 +87,12 @@ protected:
bool _useAdler0;
double _s0Adler;
double _snormAdler;
std::vector<std::string> _gFactorFixPoles;
std::vector<std::string> _gFactorFixReleaseGFactor;
std::vector<std::string> _gFactorFixKeepGRatio;
std::vector<std::string> _gFactorFixMassPol;
std::vector<std::string> _gFactorFixWidthPol;
po::options_description* _config;
};
......@@ -26,9 +26,29 @@
#include "FitParams/ParamDep.hh"
#include "FitParams/AbsPawianParameters.hh"
void ParamDep::Fill(std::string targetParameter, std::istringstream& configLine,
std::shared_ptr<AbsPawianParameters> params){
_targetName=targetParameter;
_idTarget = params->Index(targetParameter);
FillDerived(configLine, params);
// ParamDep::ParamDep(std::vector<std::string> targetParameter, std::shared_ptr<AbsPawianParameters> params){
// _params=params;
// std::vector<std::string>::iterator it;
// for(it=targetParameter.begin(); it!=targetParameter.end(); ++it){
// _targetNames.push_back(*it);
// _idsTarget.push_back(params->Index(*it));
// }
// }
void ParamDep::Fill(std::vector<std::string> targetParameter, std::shared_ptr<AbsPawianParameters> params){
_params=params;
std::vector<std::string>::iterator it;
for(it=targetParameter.begin(); it!=targetParameter.end(); ++it){
_targetNames.push_back(*it);
_idsTarget.push_back(params->Index(*it));
}
}
// void ParamDep::Fill(std::vector<std::string> targetParameter, std::istringstream& configLine,
// std::shared_ptr<AbsPawianParameters> params){
// std::vector<std::string>::iterator it;
// for(it=targetParameter.begin(); it!=targetParameter.end(); ++it){
// _targetNames.push_back(*it);
// _idsTarget.push_back(params->Index(*it));
// }
// FillDerived(configLine, params);
// }
......@@ -36,16 +36,21 @@ class AbsPawianParameters;
class ParamDep
{
public:
void Fill(std::string targetParameter, std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params);
virtual void FillDerived(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params) = 0;
ParamDep(){;}
~ParamDep(){;}
void Fill(std::vector<std::string> targetParameter, std::shared_ptr<AbsPawianParameters> params);
// void Fill(std::vector<std::string> targetParameter, std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params);
virtual void FillDerived(std::istringstream& configLine) = 0;
virtual void Apply(std::shared_ptr<AbsPawianParameters> params) = 0;
const int targetId() const {return _idTarget;}
const std::string targetName() {return _targetName;}
std::vector<unsigned int> const targetIds() const {return _idsTarget;}
std::vector<std::string> const targetNames() {return _targetNames;}
std::vector<unsigned int> const idRefs() {return _idRefs;}
protected:
int _idTarget;
std::string _targetName;
std::vector<unsigned int> _idsTarget;
std::vector<std::string> _targetNames;
std::vector<unsigned int> _idRefs;
std::shared_ptr<AbsPawianParameters> _params;
};
......@@ -28,16 +28,28 @@
#include "FitParams/AbsPawianParameters.hh"
#include "ErrLogger/ErrLogger.hh"
void ParamDepEqual::FillDerived(std::istringstream& configLine,
std::shared_ptr<AbsPawianParameters> params){
ParamDepEqual::ParamDepEqual(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params){
std::string targetParameter;
configLine >> targetParameter;
std::vector<std::string> targetParameterVec;
targetParameterVec.push_back(targetParameter);
Fill(targetParameterVec, params);
FillDerived(configLine);
}
ParamDepEqual::~ParamDepEqual(){
}
void ParamDepEqual::FillDerived(std::istringstream& configLine){
std::string parNameRef;
configLine >> parNameRef;
_idRef = params->Index(parNameRef);
_idRef = _params->Index(parNameRef);
_idRefs.push_back(_idRef);
}
void ParamDepEqual::Apply(std::shared_ptr<AbsPawianParameters> params){
params->SetValue(_idTarget, params->Value(_idRef));
params->SetValue(_idsTarget.at(0), params->Value(_idRef));
}
......
......@@ -36,8 +36,10 @@ class AbsPawianParameters;
class ParamDepEqual : public ParamDep
{
public:
virtual void FillDerived(std::istringstream& configLine,
std::shared_ptr<AbsPawianParameters> params);
ParamDepEqual(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params);
~ParamDepEqual();
virtual void FillDerived(std::istringstream& configLine);
virtual void Apply(std::shared_ptr<AbsPawianParameters> params);
private:
......
//************************************************************************//
// //
// Copyright 2014 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/>. //
// //
//************************************************************************//
// Copyright 2014 Julian Pychy
#include <iostream>
#include <sstream>
#include "FitParams/ParamDepGFacToFixGFacsWidthMass.hh"
#include "FitParams/AbsPawianParameters.hh"
#include "ConfigParser/KMatrixParser.hh"
#include "ErrLogger/ErrLogger.hh"
#include "qft++/relativistic-quantum-mechanics/Utils.hh"
ParamDepGFacToFixGFacsWidthMass::ParamDepGFacToFixGFacsWidthMass(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params){
std::vector<std::string> targetParameterVec;
std::string pathToKMatrixConfig;
configLine >> pathToKMatrixConfig;
_kMatrixParser=std::shared_ptr<KMatrixParser>(new KMatrixParser(pathToKMatrixConfig));
const std::vector<std::string> gFactorFixPoles= _kMatrixParser->gFactorFixPoles();
std::vector<std::string>::const_iterator it;
for(it=gFactorFixPoles.begin(); it!=gFactorFixPoles.end(); ++it){
Info << (*it) <<endmsg;
FixGFacsWidthMassData newData;
std::string poleMassName=(*it)+"Mass";
newData.poleMass=poleMassName;
targetParameterVec.push_back(*it);
_dataMap[*it]=newData;
}
const std::vector<std::string> gFactorFixReleaseGFactor = _kMatrixParser->gFactorFixReleaseGFactor();
for(it=gFactorFixReleaseGFactor.begin(); it!=gFactorFixReleaseGFactor.end(); ++it){
std::istringstream currentStream(*it);
std::string currentPoleName;
currentStream >> currentPoleName;
std::string currentReleasgFactorName;
currentStream >> currentReleasgFactorName;
_dataMap.at(currentPoleName).gFacReleaseName=currentReleasgFactorName;
}
const std::vector<std::string> gFactorFixKeepGRatio = _kMatrixParser->gFactorFixKeepGRatio();
for(it=gFactorFixKeepGRatio.begin(); it!=gFactorFixKeepGRatio.end(); ++it){
std::istringstream currentStream(*it);
std::string currentPoleName;
currentStream >> currentPoleName;
while (!currentStream.eof()) {
std::string currentToBeScaledgFactorName;
currentStream >> currentToBeScaledgFactorName;
_dataMap.at(currentPoleName).gFacScaleNames.push_back(currentToBeScaledgFactorName);
targetParameterVec.push_back(currentToBeScaledgFactorName);
}
}
const std::vector<std::string> gFactorFixMassPol = _kMatrixParser->gFactorFixMassPol();
for(it=gFactorFixMassPol.begin(); it!=gFactorFixMassPol.end(); ++it){
std::istringstream currentStream(*it);
std::string currentPoleName;
currentStream >> currentPoleName;
_dataMap.at(currentPoleName).massCorPol.resize(4);
std::string p0Str;
currentStream >> p0Str;
_dataMap.at(currentPoleName).massCorPol[0] = atof(p0Str.c_str());
std::string p1Str;
currentStream >> p1Str;
_dataMap.at(currentPoleName).massCorPol[1] = atof(p1Str.c_str());
std::string p2Str;
currentStream >> p2Str;
_dataMap.at(currentPoleName).massCorPol[2] = atof(p2Str.c_str());
std::string p3Str;
currentStream >> p3Str;
_dataMap.at(currentPoleName).massCorPol[3] = atof(p3Str.c_str());
}
const std::vector<std::string> gFactorFixWidthPol = _kMatrixParser->gFactorFixWidthPol();
for(it=gFactorFixWidthPol.begin(); it!=gFactorFixWidthPol.end(); ++it){
std::istringstream currentStream(*it);
std::string currentPoleName;
currentStream >> currentPoleName;
_dataMap.at(currentPoleName).widthCorPol.resize(4);
std::string p0Str;
currentStream >> p0Str;
_dataMap.at(currentPoleName).widthCorPol[0] = atof(p0Str.c_str());
std::string p1Str;
currentStream >> p1Str;
_dataMap.at(currentPoleName).widthCorPol[1] = atof(p1Str.c_str());
std::string p2Str;
currentStream >> p2Str;
_dataMap.at(currentPoleName).widthCorPol[2] = atof(p2Str.c_str());
std::string p3Str;
currentStream >> p3Str;
_dataMap.at(currentPoleName).widthCorPol[3] = atof(p3Str.c_str());
}
Fill(targetParameterVec, params);
Info << "*****ParamDepGFacToFixGFacsWidthMass*****" << endmsg;
std::map<std::string, FixGFacsWidthMassData>::iterator itMap;
for(itMap=_dataMap.begin(); itMap!=_dataMap.end(); ++itMap) itMap->second.print(std::cout);
}
ParamDepGFacToFixGFacsWidthMass::~ParamDepGFacToFixGFacsWidthMass(){
}
void ParamDepGFacToFixGFacsWidthMass::FillDerived(std::istringstream& configLine){
}
void ParamDepGFacToFixGFacsWidthMass::Apply(std::shared_ptr<AbsPawianParameters> params){
std::map<std::string, FixGFacsWidthMassData>::iterator itMap;
for(itMap=_dataMap.begin(); itMap!=_dataMap.end(); ++itMap){
std::string currentPoleMassName= itMap->second.poleMass;
double currengFacVal=params->Value(itMap->second.gFacReleaseName);
double newKpoleMass=itMap->second.massCorPol.at(0)
+itMap->second.massCorPol.at(1)*currengFacVal
+itMap->second.massCorPol.at(2)*currengFacVal*currengFacVal
+itMap->second.massCorPol.at(3)*currengFacVal*currengFacVal*currengFacVal;
params->SetValue(currentPoleMassName, newKpoleMass);
double newgFacorScaler=itMap->second.widthCorPol.at(0)
+itMap->second.widthCorPol.at(1)*currengFacVal
+itMap->second.widthCorPol.at(2)*currengFacVal*currengFacVal
+itMap->second.widthCorPol.at(3)*currengFacVal*currengFacVal*currengFacVal;
std::vector<std::string>::iterator itStr;
for(itStr=itMap->second.gFacScaleNames.begin(); itStr!=itMap->second.gFacScaleNames.end(); ++itStr){
double newVal= params->Value(*itStr)*newgFacorScaler;
params->SetValue((*itStr), newVal);
}
}
}
//************************************************************************//
// //
// Copyright 2014 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/>. //
// //
//************************************************************************//
// ParamDepGFacToFixGFacsWidthMass class definition file. -*- C++ -*-
// Copyright 2014 Julian Pychy
#include "FitParams/ParamDep.hh"
#include <vector>
#include <string>
#include <memory>
#include <sstream>
#include <map>
class AbsPawianParameters;
class KMatrixParser;
struct FixGFacsWidthMassData
{
std::string poleMass;
std::string gFacReleaseName;
std::vector<std::string> gFacScaleNames;
std::vector<double> massCorPol;
std::vector<double> widthCorPol;
void print(std::ostream& os) const {
os <<"pole: " << poleMass
<<"\t released g-factor: " << gFacReleaseName << std::endl;
os <<"g factors to be scaled:";
std::vector<std::string>::const_iterator itStr;
for(itStr=gFacScaleNames.begin(); itStr != gFacScaleNames.end(); ++itStr){
os << "\t" << (*itStr);
}
os << "\nparameter for pole mass correction: ";
std::vector<double>::const_iterator itDouble;
for(itDouble=massCorPol.begin(); itDouble!=massCorPol.end(); ++itDouble){
os<<"\t" << (*itDouble);
}
os << "\nparameter for pole width correction: ";
for(itDouble=widthCorPol.begin(); itDouble!=widthCorPol.end(); ++itDouble){
os<<"\t" << (*itDouble);
}
os<<"\n" << std::endl;
}
};
class ParamDepGFacToFixGFacsWidthMass : public ParamDep
{
public:
ParamDepGFacToFixGFacsWidthMass(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params);
~ParamDepGFacToFixGFacsWidthMass();
virtual void FillDerived(std::istringstream& configLine);
virtual void Apply(std::shared_ptr<AbsPawianParameters> params);
private:
double _targetFullWidth;
std::shared_ptr<KMatrixParser> _kMatrixParser;
std::vector<std::string> _poleNames;
std::map<std::string, FixGFacsWidthMassData> _dataMap;
};
......@@ -30,15 +30,27 @@
#include "ErrLogger/ErrLogger.hh"
#include "qft++/relativistic-quantum-mechanics/Utils.hh"
void ParamDepGFactorToFixFullWidth::FillDerived(std::istringstream& configLine,
std::shared_ptr<AbsPawianParameters> params){
ParamDepGFactorToFixFullWidth::ParamDepGFactorToFixFullWidth(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params){
std::string targetParameter;
configLine >> targetParameter;
std::vector<std::string> targetParameterVec;
targetParameterVec.push_back(targetParameter);
Fill(targetParameterVec, params);
FillDerived(configLine);
}
ParamDepGFactorToFixFullWidth::~ParamDepGFactorToFixFullWidth(){
}
void ParamDepGFactorToFixFullWidth::FillDerived(std::istringstream& configLine){
configLine >> _targetFullWidth;
std::string massParamName;
configLine >> massParamName;
_targetChannelData.massParamId = params->Index(massParamName);
_targetChannelData.gParamId = _idTarget;
_targetChannelData.massParamId = _params->Index(massParamName);
_targetChannelData.gParamId = _idsTarget.at(0);
configLine >> _targetChannelData.m1 >> _targetChannelData.m2;
int numRefChannels;
......@@ -48,13 +60,13 @@ void ParamDepGFactorToFixFullWidth::FillDerived(std::istringstream& configLine,
ChannelData newChannelData;
configLine >> massParamName;
newChannelData.massParamId = params->Index(massParamName);
_idRefs.push_back(params->Index(massParamName));
newChannelData.massParamId = _params->Index(massParamName);
_idRefs.push_back(_params->Index(massParamName));
std::string gParamName;
configLine >> gParamName;
newChannelData.gParamId = params->Index(gParamName);
_idRefs.push_back(params->Index(gParamName));
newChannelData.gParamId = _params->Index(gParamName);
_idRefs.push_back(_params->Index(gParamName));
configLine >> newChannelData.m1 >> newChannelData.m2;
_refChannelData.push_back(newChannelData);
......
......@@ -46,8 +46,10 @@ struct ChannelData
class ParamDepGFactorToFixFullWidth : public ParamDep
{
public:
virtual void FillDerived(std::istringstream& configLine,
std::shared_ptr<AbsPawianParameters> params);
ParamDepGFactorToFixFullWidth(std::istringstream& configLine, std::shared_ptr<AbsPawianParameters> params);
~ParamDepGFactorToFixFullWidth();
virtual void FillDerived(std::istringstream& configLine);
virtual void Apply(std::shared_ptr<AbsPawianParameters> params);
private:
......
......@@ -24,6 +24,7 @@
#include "FitParams/ParamDepHandler.hh"
#include "FitParams/ParamDepEqual.hh"
#include "FitParams/ParamDepGFactorToFixFullWidth.hh"
#include "FitParams/ParamDepGFacToFixGFacsWidthMass.hh"
#include "ErrLogger/ErrLogger.hh"
......@@ -47,13 +48,16 @@ void ParamDepHandler::Fill(const std::vector<std::string>& configLines,
std::shared_ptr<ParamDep> newDependency;
std::string targetParameter;
std::string type;
currentStream >> targetParameter >> type;
currentStream >> type;
if(type == "equals"){
newDependency = std::shared_ptr<ParamDep>(new ParamDepEqual);
newDependency = std::shared_ptr<ParamDep>(new ParamDepEqual(currentStream, params));
}
else if(type == "gFactorToFixFullWidth"){
newDependency = std::shared_ptr<ParamDep>(new ParamDepGFactorToFixFullWidth);
newDependency = std::shared_ptr<ParamDep>(new ParamDepGFactorToFixFullWidth(currentStream, params));
}
else if(type == "gFacToFixGFacsWidthMass"){
newDependency = std::shared_ptr<ParamDep>(new ParamDepGFacToFixGFacsWidthMass(currentStream, params));
}
else{
Alert << "Dependency type not found: " << type << endmsg;
......@@ -63,8 +67,13 @@ void ParamDepHandler::Fill(const std::vector<std::string>& configLines,
Info << "Adding parameter dependency for " << targetParameter << " type "
<< type << " arguments " << currentStream.str() << endmsg;
newDependency->Fill(targetParameter, currentStream, params);
_dependentParameterNames.push_back(targetParameter);
std::vector<std::string> targetParameterVec=newDependency->targetNames();
std::vector<std::string>::iterator itParam;
for(itParam= targetParameterVec.begin(); itParam!= targetParameterVec.end(); ++itParam){
std::vector<std::string>::iterator foundParam;
foundParam=std::find(_dependentParameterNames.begin(), _dependentParameterNames.end(), (*itParam));
if(foundParam == _dependentParameterNames.end()) _dependentParameterNames.push_back(*itParam);
}
_dependencies.push_back(newDependency);
}
}
......@@ -78,8 +87,12 @@ void ParamDepHandler::ApplyDependencies(std::shared_ptr<AbsPawianParameters> par
std::vector<unsigned int> ParamDepHandler::RefIds(std::string parName){
std::vector<unsigned int> result;
for(auto it = _dependencies.begin(); it!= _dependencies.end(); ++it){
if( (*it)->targetName()==parName) result=(*it)->idRefs();
continue;
std::vector<std::string> currentNames=(*it)->targetNames();
std::vector<std::string>::const_iterator itNames;
for(itNames=currentNames.begin(); itNames!=currentNames.end(); ++itNames){
if( (*itNames)==parName) result=(*it)->idRefs();
continue;
}
}
return result;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment