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

reduced memory for caching WignerD values

parent ae062542
No related branches found
No related tags found
No related merge requests found
......@@ -288,8 +288,11 @@ void AbsDecay::fillWignerDs(std::map<std::string, Vector4<double> >& fsMap, Vect
for (Spin lam12=-lam12Max; lam12<=lam12Max; ++lam12){
double thePhi=0.;
if(_hasMotherPart) thePhi=daughter2HelMother.Phi();
evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12]=Wigner_D(thePhi,daughter2HelMother.Theta(),0,spinMother,lamMother,lam12);
if(evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12] != evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12]){
unsigned int IdSpinMotherLamMotherLam12=FunctionUtils::spin3Index(spinMother, lamMother, lam12);
evtData->WignerDStringId[_wignerDKey][IdSpinMotherLamMotherLam12]=Wigner_D(thePhi,daughter2HelMother.Theta(),0,spinMother,lamMother,lam12);
// evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12]=Wigner_D(thePhi,daughter2HelMother.Theta(),0,spinMother,lamMother,lam12);
// if(evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12] != evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12]){
if(evtData->WignerDStringId[_wignerDKey][IdSpinMotherLamMotherLam12] != evtData->WignerDStringId[_wignerDKey][IdSpinMotherLamMotherLam12]){
DebugMsg << "WignerDsString nan:\t" << evtData->WignerDsString[_wignerDKey][spinMother][lamMother][lam12] << endmsg;
DebugMsg << "daughter2HelMother.Theta():\t" << daughter2HelMother.Theta() << endmsg;
DebugMsg << "thePhi:\t" << thePhi << endmsg;
......
......@@ -54,6 +54,7 @@ AbsXdecAmp::AbsXdecAmp(std::shared_ptr<AbsDecay> theDec, ChannelID channelID) :
,_daughter2IsStable(theDec->isDaughter2Stable())
,_enabledlamFsDaughter1(false)
,_enabledlamFsDaughter2(false)
,_J(theDec->motherJPC()->J)
{
initialize();
}
......
......@@ -93,6 +93,7 @@ protected:
bool _enabledlamFsDaughter1;
bool _enabledlamFsDaughter2;
Spin _J;
intShortComplFloatMap _cachedAmpShortMap;
// intSpinSpinFloatUsMap _cachedAmpMap;
......
......@@ -40,6 +40,7 @@ typedef std::map<int, Vector4<double> > mapInt4Vec;
typedef std::map<int, map<Spin,map<Spin,map<Spin,complex<double> > > > > mapIntSpinComplex;
typedef std::map<std::string, Vector4<double> > mapString4Vec;
typedef std::map<std::string, map<Spin,map<Spin,map<Spin,complex<double> > > > > mapStringSpinComplex;
typedef std::map<std::string, std::map<unsigned int, complex<double> > > mapStringIntComplex;
typedef std::map<std::string, double> mapStringDouble;
typedef std::map<std::string, map<Spin,map<Spin, complex<double> > > > mapStringComplDouble;
typedef std::map<std::string, map<Spin,map<Spin,map<Spin, map<Spin, map<Spin,complex<double> > > > > > > mapString5SpinsComplex;
......@@ -51,6 +52,7 @@ struct EvtData {
mapIntSpinComplex WignerDsDec;
mapString4Vec FourVecsString;
mapStringSpinComplex WignerDsString;
mapStringIntComplex WignerDStringId;
mapStringDouble DoubleString;
mapStringComplDouble ComplexDoubleString;
mapString5SpinsComplex ComplexDouble5SpinString;
......
......@@ -34,7 +34,7 @@
#include "PwaUtils/DataUtils.hh"
#include "PwaUtils/GlobalEnv.hh"
#include "PwaUtils/IsobarLSDecay.hh"
//#include "PwaUtils/XdecAmpRegistry.hh"
#include "Utils/FunctionUtils.hh"
#include "Particle/Particle.hh"
#include "ErrLogger/ErrLogger.hh"
......@@ -160,7 +160,9 @@ complex<double> LSDecAmps::lsLoop(Spin& lamX, EvtData* theData, Spin& lam1Min, S
complex<double> result(0.,0.);
map<Spin,complex<double> >& currentWignerDsMap=theData->WignerDsString.at(_wignerDKey).at(_JPCPtr->J).at(lamX);
// map<Spin,complex<double> >& currentWignerDsMap=theData->WignerDsString.at(_wignerDKey).at(_JPCPtr->J).at(lamX);
// Spin currentJ=_JPCPtr->J;
std::map<unsigned int, complex<double> >& currentWignerDMap=theData->WignerDStringId.at(_wignerDKey);
std::vector< std::shared_ptr<const LScomb> >::iterator it;
for (it=_LSs.begin(); it!=_LSs.end(); ++it){
......@@ -175,7 +177,9 @@ complex<double> LSDecAmps::lsLoop(Spin& lamX, EvtData* theData, Spin& lam1Min, S
for(Spin lambda2=lam2Min; lambda2<=lam2Max; ++lambda2){
Spin lambda = lambda1-lambda2;
if( fabs(lambda)>_JPCPtr->J || fabs(lambda)>(*it)->S) continue;
complex<double> amp = theMag*expi*currentCgFactor.at(lambda1).at(lambda2)*conj(currentWignerDsMap.at(lambda));
unsigned int IdJLamXLam12=FunctionUtils::spin3Index(_J, lamX, lambda);
complex<double> amp = theMag*expi*currentCgFactor.at(lambda1).at(lambda2)*conj(currentWignerDMap.at(IdJLamXLam12));
// complex<double> amp = theMag*expi*currentCgFactor.at(lambda1).at(lambda2)*conj(currentWignerDsMap.at(lambda));
if(withDecs) amp *=daughterAmp(lambda1, lambda2, theData, lamFs);
result+=amp;
}
......
......@@ -2,7 +2,7 @@
#include "Utils/FunctionUtils.hh"
#include "Particle/Particle.hh"
#include "qft++/relativistic-quantum-mechanics/Spin.hh"
namespace FunctionUtils{
......@@ -24,5 +24,10 @@ namespace FunctionUtils{
return result;
}
unsigned int spin3Index(Spin& spin1, Spin& spin2, Spin& spin3){
unsigned int result=spin1.ToIndex()*100*100+spin2.ToIndex()*100+spin3.ToIndex();
return result;
}
}
......@@ -5,10 +5,11 @@
#include <string>
class Particle;
class Spin;
namespace FunctionUtils {
std::string particleListName(std::vector<Particle*>& particleVec);
unsigned int spin3Index(Spin& spin1, Spin& spin2, Spin& spin3);
}
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