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

introduced new class AbsDecayList

parent 2d452f3c
No related branches found
No related tags found
No related merge requests found
// AbsDecayList class definition file. -*- C++ -*-
// Copyright 2012 Bertram Kopf
#include <getopt.h>
#include <fstream>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include "PwaUtils/AbsDecayList.hh"
#include "PwaUtils/AbsDecay.hh"
#include "qft++/relativistic-quantum-mechanics/Utils.hh"
#include "ErrLogger/ErrLogger.hh"
#include "Particle/Particle.hh"
AbsDecayList::AbsDecayList(){
}
AbsDecayList::~AbsDecayList(){
}
void AbsDecayList::addDecay(boost::shared_ptr<AbsDecay> theIsoDec){
// const std::string key = theIsoDec->motherPart()->name();
// std::map<const std::string, boost::shared_ptr<AbsDecay> >::iterator it;
// it=_absDecList.find(key);
// if (it != _absDecList.end()){
_absDecList.push_back(theIsoDec);
// }
// else{
// Warning << "decay of the particle " << key << " already exists\n"
// << "new decay cannot be added!!!" << endmsg;
// }
}
boost::shared_ptr<AbsDecay> AbsDecayList::decay(Particle* mother){
boost::shared_ptr<AbsDecay> result;
const std::string key = mother->name();
std::vector<boost::shared_ptr<AbsDecay> >::iterator it;
for (it=_absDecList.begin(); it!=_absDecList.end(); ++it){
if (key==(*it)->motherPart()->name()){
result=(*it);
break;
}
}
return result;
}
boost::shared_ptr<AbsDecay> AbsDecayList::decay(const std::string& name){
boost::shared_ptr<AbsDecay> result;
std::vector<boost::shared_ptr<AbsDecay> >::iterator it;
for (it=_absDecList.begin(); it!=_absDecList.end(); ++it){
if (name==(*it)->name()){
result=(*it);
break;
}
}
return result;
}
void AbsDecayList::replaceSuffix(const std::string& oldPart, const std::string& newPart){
std::vector<boost::shared_ptr<AbsDecay> >::iterator it;
for (it= _absDecList.begin(); it!=_absDecList.end(); ++it){
std::string theSuffix= (*it)->fitParSuffix();
boost::replace_all(theSuffix, oldPart, newPart);
(*it)->setFitParSuffix(theSuffix);
}
}
void AbsDecayList::replaceMassKey(const std::string& oldPart, const std::string& newPart){
std::vector<boost::shared_ptr<AbsDecay> >::iterator it;
for (it= _absDecList.begin(); it!=_absDecList.end(); ++it){
if(oldPart== (*it)->massParKey()){
(*it)->setMassParKey(newPart);
}
}
}
// AbsDecayList class definition file. -*- C++ -*-
// Copyright 2012 Bertram Kopf
#pragma once
#include <iostream>
#include <vector>
#include <complex>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <boost/shared_ptr.hpp>
#include "PwaUtils/DataUtils.hh"
class Particle;
class AbsDecay;
class AbsDecayList {
public:
AbsDecayList();
~AbsDecayList();
void addDecay(boost::shared_ptr<AbsDecay> theIsoDec);
boost::shared_ptr<AbsDecay> decay(Particle* mother);
boost::shared_ptr<AbsDecay> decay(const std::string& name);
void replaceSuffix(const std::string& oldPart, const std::string& newPart);
void replaceMassKey(const std::string& oldPart, const std::string& newPart);
std::vector<boost::shared_ptr<AbsDecay> >& getList() {return _absDecList;}
protected:
std::vector<boost::shared_ptr<AbsDecay> > _absDecList;
};
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