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

get rid of PsiToXGamReader

parent 1a2ce9c1
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,6 @@
#include "qft++/topincludes/relativistic-quantum-mechanics.hh"
#include "PwaUtils/AbsLh.hh"
#include "PwaUtils/PsiToXGamStates.hh"
#include "PwaUtils/DataUtils.hh"
#include "Minuit2/MnUserParameters.h"
......
// Bertram Kopf (RUB)
#include "PwaUtils/PsiToXGamParser.hh"
#include "ErrLogger/ErrLogger.hh"
#include <iterator>
#include <iostream>
#include <fstream>
using namespace std;
PsiToXGamParser::PsiToXGamParser(int argc,char **argv):
ParserBase(argc,argv)
,_massIndependentFit(false)
, _useCommonProductionPhases(false)
, _massMin(0.7)
, _massMax(3.1)
, _jobOption("")
{
po::options_description common("Common Options");
common.add_options()
("massIndependentFit", po::value<bool>(&_massIndependentFit), "enable/disable mass independence in fit")
("commonProdPhases",po::value<bool>(&_useCommonProductionPhases), "enable/disable common production phases")
;
_common->add(common);
po::options_description config("Configuration file options");
config.add_options()
("massRangeMin",po::value<double>(&_massMin), "min of eta pi pi mass range for mass indep. fit")
("massRangeMax",po::value<double>(&_massMax), "max of eta pi pi mass range for mass indep. fit")
("jobOption",po::value<string>(&_jobOption), "add a jobOption string to all produced files")
;
_config->add(config);
parseCommandLine(argc, argv);
}
#ifndef PsiToXGamParser_HH
#define PsiToXGamParser_HH
#include "PwaUtils/ParserBase.hh"
// Boost headers go here
class PsiToXGamParser : public ParserBase
{
public:
PsiToXGamParser(int argc,char **argv);
virtual ~PsiToXGamParser(){;}
const bool massIndependentFit() const {return _massIndependentFit; }
const bool useCommonProductionPhases() const {return _useCommonProductionPhases; }
const std::pair<double, double> massRange() const { return std::make_pair( _massMin, _massMax ) ; }
const std::string getjobOption() const {return _jobOption;}
protected:
bool _massIndependentFit;
bool _useCommonProductionPhases;
double _massMin;
double _massMax;
std::string _jobOption;
};
#endif /*PsiToXGamParser_HH */
#include "PwaUtils/PsiToXGamReader.hh"
#include "Event/EventList.hh"
#include "Event/Event.hh"
#include "ErrLogger/ErrLogger.hh"
PsiToXGamReader::PsiToXGamReader()
{}
PsiToXGamReader::PsiToXGamReader(const std::vector<std::string>& files, int particles, int skip, bool useWeight):
EventReader(useWeight),
numParticles(particles),
linesToSkip(skip),
_useMassRange(false),
_massRange(std::make_pair(0.,10.) )
{
if (0 == files.size()) {
Alert << "empty list of event files" ; // << endmsg;
exit(1);
}
std::vector<std::string>::const_iterator iter = files.begin();
for (; iter != files.end(); ++iter)
fileNames.push_back(*iter);
currentFile = fileNames.begin();
}
PsiToXGamReader::~PsiToXGamReader()
{}
bool PsiToXGamReader::fillAll(EventList& evtList)
{
while (currentFile != fileNames.end()) {
currentStream.open(currentFile->c_str());
if (!currentStream) {
Alert << "can not open " << *currentFile ; // << endmsg;
exit(1);
}
while (!currentStream.eof()) {
double e,px,py,pz;
Event* newEvent = new Event();
int parts;
if(_useWeight)
{
double weight;
currentStream >> weight;
newEvent->addWeight(weight);
}
Vector4<double> fvX(0,0,0,0); //X four-vector
for (parts = 0; parts < numParticles; parts++) {
currentStream >> px >> py >> pz >> e;
newEvent->addParticle(e,px,py,pz);
Vector4<double> tmp = newEvent->p4(parts);
if(parts>0) fvX= fvX+tmp;
}
if(_useMassRange){
if(fvX.Mass()<_massRange.first || fvX.Mass()>_massRange.second ) continue;
}
if (!currentStream.fail()) {
evtList.add(newEvent);
for (parts = 0; parts < linesToSkip; parts++)
currentStream >> px >> py >> pz >> e;
}
}
currentStream.close();
++currentFile;
}
evtList.rewind();
return true; // success
}
#ifndef PsiToXGamReader_HH
#define PsiToXGamReader_HH
#include "Event/EventReader.hh"
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <utility>
class EventList;
class PsiToXGamReader : public EventReader
{
public:
PsiToXGamReader();
PsiToXGamReader(const std::vector<std::string>& files, int particles, int skip, bool useWeight=false);
virtual ~PsiToXGamReader();
virtual bool fillAll(EventList& evtList);
bool fillMassRange(EventList& evtList, std::pair<double,double> massRange){
_useMassRange=true;
_massRange = massRange;
return fillAll(evtList);
};
private:
std::vector<std::string> fileNames;
std::vector<std::string>::const_iterator currentFile;
std::ifstream currentStream;
int numParticles;
int linesToSkip;
bool _useMassRange;
std::pair<double,double> _massRange;
};
#endif
#include <getopt.h>
#include <fstream>
#include <sstream>
#include <string>
#include "PwaUtils/PsiToXGamStates.hh"
#include "ErrLogger/ErrLogger.hh"
PsiToXGamStates::PsiToXGamStates() :
_psiJPC(new jpcRes(1, -1, -1)),
_gammaJPC(new jpcRes(1, -1, -1)),
_etaJPC(new jpcRes(0, -1, 1)),
_f0JPC(new jpcRes(0, 1, 1)),
_f1JPC(new jpcRes(1, 1, 1)),
_f2JPC(new jpcRes(2, 1, 1)),
_eta2JPC(new jpcRes(2,-1,1) )
{
//LS combinations for Psi decays to X gamma
fillJPCLS(_psiJPC, _etaJPC , _gammaJPC, _JPCLS_PsiToEtaGamma );
fillJPCLS(_psiJPC, _f0JPC , _gammaJPC, _JPCLS_PsiToF0Gamma );
fillJPCLS(_psiJPC, _f1JPC , _gammaJPC, _JPCLS_PsiToF1Gamma );
fillJPCLS(_psiJPC, _f2JPC , _gammaJPC, _JPCLS_PsiToF2Gamma );
fillJPCLS(_psiJPC, _eta2JPC, _gammaJPC, _JPCLS_PsiToEta2Gamma);
fillJPClamlam(_JPCLS_PsiToEtaGamma, _etaJPC, _JPCLamLam_PsiToEtaGamma);
fillJPClamlam(_JPCLS_PsiToF0Gamma, _f0JPC, _JPCLamLam_PsiToF0Gamma);
fillJPClamlam(_JPCLS_PsiToF2Gamma, _f1JPC, _JPCLamLam_PsiToF1Gamma);
fillJPClamlam(_JPCLS_PsiToF2Gamma, _f2JPC, _JPCLamLam_PsiToF2Gamma);
fillJPClamlam(_JPCLS_PsiToEta2Gamma, _eta2JPC, _JPCLamLam_PsiToEta2Gamma);
}
PsiToXGamStates::~PsiToXGamStates()
{
}
void PsiToXGamStates::fillJPCLS(boost::shared_ptr<jpcRes> motherRes, boost::shared_ptr<jpcRes> daughterRes1, boost::shared_ptr<jpcRes> daughterRes2, std::vector< boost::shared_ptr<const JPCLS> >& theJPCLSVec)
{
// first: check C-parity
if ( motherRes->C != daughterRes1->C*daughterRes2->C){
Warning << "C-Parity not valid for the reaction: JPC= "
<< motherRes->J << " " << motherRes->P << " " << motherRes->C
<< " --> "
<< " JPC= " << daughterRes1->J << " " << daughterRes1->P << " " << daughterRes1->C
<< " and "
<< " JPC= " << daughterRes2->J << " " << daughterRes2->P << " " << daughterRes2->C
; // << endmsg;
}
vector<LS> LSs=GetValidLS(motherRes->J, motherRes->P, daughterRes1->J, daughterRes1->P, daughterRes2->J, daughterRes2->P);
int num_LS = (int) LSs.size();
for(int ls = 0; ls < num_LS; ls++){
Spin L= LSs[ls].L;
Spin S= LSs[ls].S;
boost::shared_ptr<const JPCLS> tmpJPCLS(new JPCLS(motherRes, L, S));
theJPCLSVec.push_back(tmpJPCLS);
}
}
void PsiToXGamStates::fillJPClamlam(std::vector< boost::shared_ptr<const JPCLS> >& theJPCLSvec, boost::shared_ptr<jpcRes> xRes, std::vector< boost::shared_ptr<const JPClamlam> >& toFill){
//retrieve Smax
Spin Smax(0);
std::vector< boost::shared_ptr<const JPCLS> >::iterator it;
for (it=theJPCLSvec.begin(); it!=theJPCLSvec.end(); ++it){
Spin currentS=(*it)->S;
if ( Smax < currentS) Smax=currentS;
}
Info << "Smax= " << Smax << endmsg;
Spin lamgam(1);
for (Spin lamx = 0; lamx <= xRes->J; ++lamx){
if (fabs(lamx-lamgam)>_psiJPC->J || fabs(lamx-lamgam)>Smax) continue;
double parityFactor = _psiJPC->P * xRes->P * _gammaJPC->P * pow(-1., xRes->J+_gammaJPC->J-_psiJPC->J );
boost::shared_ptr<const JPClamlam> tmpJPClamlam(new JPClamlam(_psiJPC, lamx, lamgam, parityFactor));
toFill.push_back(tmpJPClamlam);
}
}
void PsiToXGamStates::print(std::ostream& os) const
{
os << "*** Psi -> Eta gamma: LS combinations for the decay *** "<< std::endl;
printDecayJPCLS(os, _JPCLS_PsiToEtaGamma );
os << "*** Psi -> Eta gamma: lambda lambda combinations for the decay *** "<< std::endl;
printDecayJPClamlam(os, _JPCLamLam_PsiToEtaGamma );
os << "*** Psi -> f0 gamma: LS combinations for the decay *** "<< std::endl;
printDecayJPCLS(os, _JPCLS_PsiToF0Gamma );
os << "*** Psi -> f0 gamma: lambda lambda combinations for the decay *** "<< std::endl;
printDecayJPClamlam(os, _JPCLamLam_PsiToF0Gamma);
os << "*** Psi -> f1 gamma: LS combinations for the decay *** "<< std::endl;
printDecayJPCLS(os, _JPCLS_PsiToF1Gamma );
os << "*** Psi -> f1 gamma: lambda lambda combinations for the decay *** "<< std::endl;
printDecayJPClamlam(os, _JPCLamLam_PsiToF1Gamma);
os << "*** Psi -> f2 gamma: LS combinations for the decay *** "<< std::endl;
printDecayJPCLS(os, _JPCLS_PsiToF2Gamma );
os << "*** Psi -> f2 gamma: lambda lambda combinations for the decay *** "<< std::endl;
printDecayJPClamlam(os, _JPCLamLam_PsiToF2Gamma);
os << "*** Psi -> eta2 gamma: LS combinations for the decay *** "<< std::endl;
printDecayJPCLS(os, _JPCLS_PsiToEta2Gamma );
os << "*** Psi -> eta2 gamma: lambda lambda combinations for the decay *** "<< std::endl;
printDecayJPClamlam(os, _JPCLamLam_PsiToEta2Gamma );
}
void PsiToXGamStates::printDecayJPCLS(std::ostream& os,std::vector< boost::shared_ptr<const JPCLS > > theJPCLS) const{
std::vector< boost::shared_ptr<const JPCLS > >::const_iterator itJPCLS;
for ( itJPCLS=theJPCLS.begin(); itJPCLS!=theJPCLS.end(); ++itJPCLS){
(*itJPCLS)->print(os);
os << "\n" << std::endl;
}
}
void PsiToXGamStates::printDecayJPClamlam(std::ostream& os,std::vector< boost::shared_ptr<const JPClamlam > > theJPClamlam) const{
std::vector< boost::shared_ptr<const JPClamlam > >::const_iterator it;
for ( it=theJPClamlam.begin(); it!=theJPClamlam.end(); ++it){
(*it)->print(os);
os << "\n" << std::endl;
}
}
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "qft++/topincludes/relativistic-quantum-mechanics.hh"
#include "PwaUtils/DataUtils.hh"
class PsiToXGamStates {
public:
PsiToXGamStates();
virtual ~PsiToXGamStates();
virtual std::vector< boost::shared_ptr<const JPCLS> > PsiToEtaGammaStates() const {
return _JPCLS_PsiToEtaGamma;
}
virtual std::vector< boost::shared_ptr<const JPCLS> > PsiToF0GammaStates() const {
return _JPCLS_PsiToF0Gamma;
}
virtual std::vector< boost::shared_ptr<const JPCLS> > PsiToF1GammaStates() const {
return _JPCLS_PsiToF1Gamma;
}
virtual std::vector< boost::shared_ptr<const JPCLS> > PsiToF2GammaStates() const {
return _JPCLS_PsiToF2Gamma;
}
virtual std::vector< boost::shared_ptr<const JPCLS> > PsiToEta2GammaStates() const {
return _JPCLS_PsiToEta2Gamma;
}
virtual std::vector< boost::shared_ptr<const JPClamlam> > PsiToEtaGammaLamLamStates() const {
return _JPCLamLam_PsiToEtaGamma;
}
virtual std::vector< boost::shared_ptr<const JPClamlam> > PsiToF0GammaLamLamStates() const {
return _JPCLamLam_PsiToF0Gamma;
}
virtual std::vector< boost::shared_ptr<const JPClamlam> > PsiToF1GammaLamLamStates() const {
return _JPCLamLam_PsiToF1Gamma;
}
virtual std::vector< boost::shared_ptr<const JPClamlam> > PsiToF2GammaLamLamStates() const {
return _JPCLamLam_PsiToF2Gamma;
}
virtual std::vector< boost::shared_ptr<const JPClamlam> > PsiToEta2GammaLamLamStates() const {
return _JPCLamLam_PsiToEta2Gamma;
}
virtual void print(std::ostream& os) const;
protected:
virtual void fillJPCLS(boost::shared_ptr<jpcRes>, boost::shared_ptr<jpcRes>,
boost::shared_ptr<jpcRes>,
std::vector< boost::shared_ptr<const JPCLS> >& );
virtual void fillJPClamlam(std::vector< boost::shared_ptr<const JPCLS> >& theJPCLSvec,
boost::shared_ptr<jpcRes> xRes,
std::vector< boost::shared_ptr<const JPClamlam> >& toFill);
virtual void printDecayJPCLS(std::ostream& os,
std::vector< boost::shared_ptr<const JPCLS > > theJPCLS) const;
virtual void printDecayJPClamlam(std::ostream& os,
std::vector< boost::shared_ptr<const JPClamlam > >
theJPClamlam) const;
private:
boost::shared_ptr<jpcRes> _psiJPC;
boost::shared_ptr<jpcRes> _gammaJPC;
boost::shared_ptr<jpcRes> _etaJPC;
boost::shared_ptr<jpcRes> _f0JPC;
boost::shared_ptr<jpcRes> _f1JPC;
boost::shared_ptr<jpcRes> _f2JPC;
boost::shared_ptr<jpcRes> _eta2JPC;
std::vector< boost::shared_ptr<const JPCLS> > _JPCLS_PsiToEtaGamma;
std::vector< boost::shared_ptr<const JPCLS> > _JPCLS_PsiToF0Gamma;
std::vector< boost::shared_ptr<const JPCLS> > _JPCLS_PsiToF1Gamma;
std::vector< boost::shared_ptr<const JPCLS> > _JPCLS_PsiToF2Gamma;
std::vector< boost::shared_ptr<const JPCLS> > _JPCLS_PsiToEta2Gamma;
std::vector< boost::shared_ptr<const JPClamlam> > _JPCLamLam_PsiToEtaGamma;
std::vector< boost::shared_ptr<const JPClamlam> > _JPCLamLam_PsiToF0Gamma;
std::vector< boost::shared_ptr<const JPClamlam> > _JPCLamLam_PsiToF1Gamma;
std::vector< boost::shared_ptr<const JPClamlam> > _JPCLamLam_PsiToF2Gamma;
std::vector< boost::shared_ptr<const JPClamlam> > _JPCLamLam_PsiToEta2Gamma;
};
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