std::shared_ptr<FunctionTree> AmpWigner2::SetupTree( ParameterList& sample, std::string suffix) { std::shared_ptr<FunctionTree> newTree(new FunctionTree()); int sampleSize = sample.GetMultiDouble(0)->GetNValues(); //----Strategies needed std::shared_ptr<WignerDStrategy> angdStrat( new WignerDStrategy("AngD"+suffix) ); newTree->createHead("AngD_"+suffix, angdStrat, sampleSize); newTree->createLeaf("spin",_spin.Val(), "AngD_"+suffix); //spin newTree->createLeaf("m", _mu, "AngD_"+suffix); //OutSpin 1 newTree->createLeaf("n", _muPrime, "AngD_"+suffix); //OutSpin 2 newTree->createLeaf("AngD_sample", sample.GetMultiDouble(_varId), "AngD_"+suffix); return newTree; }
void ParameterList::Append(const ParameterList& addList) { for(int i=0; i<addList.GetNBool(); i++ ) AddParameter(addList.GetBoolParameter(i)); for(int i=0; i<addList.GetNInteger(); i++ ) AddParameter(addList.GetIntegerParameter(i)); for(int i=0; i<addList.GetNDouble(); i++ ) AddParameter(addList.GetDoubleParameter(i)); for(int i=0; i<addList.GetNComplex(); i++ ) AddParameter(addList.GetComplexParameter(i)); for(int i=0; i<addList.GetNMultiDouble(); i++ ) AddParameter(addList.GetMultiDouble(i)); for(int i=0; i<addList.GetNMultiComplex(); i++ ) AddParameter(addList.GetMultiComplex(i)); for(int i=0; i<addList.GetNMultiUnsignedInteger(); i++ ) AddParameter(addList.GetMultiUnsignedInteger(i)); }
bool WignerDStrategy::execute(ParameterList& paras, std::shared_ptr<AbsParameter>& out) { #ifdef DEBUG if( checkType != out->type() ) { throw( WrongParType( std::string("Output Type ") +ParNames[out->type()]+std::string(" conflicts expected type ") +ParNames[checkType]+std::string(" of ")+name+" Wigner strat") ); return false; } #endif double _inSpin = paras.GetDoubleParameter(0)->GetValue(); double _outSpin1 = paras.GetDoubleParameter(1)->GetValue(); double _outSpin2 = paras.GetDoubleParameter(2)->GetValue(); ComPWA::Physics::DPKinematics::DalitzKinematics* kin = dynamic_cast<ComPWA::Physics::DPKinematics::DalitzKinematics*>( Kinematics::instance() ); std::shared_ptr<MultiDouble> _angle = paras.GetMultiDouble(0); std::vector<double> results(_angle->GetNValues(), 0.); for(unsigned int ele=0; ele<_angle->GetNValues(); ele++){ try{ results.at(ele)=AmpWigner2::dynamicalFunction( _inSpin,_outSpin1,_outSpin2,_angle->GetValue(ele) ); } catch (std::exception &ex) { BOOST_LOG_TRIVIAL(error) << "WignerDStrategy::execute() | " <<ex.what(); throw std::runtime_error("WignerDStrategy::execute() | " "Evaluation of dynamical function failed!"); } }//end element loop out = std::shared_ptr<AbsParameter>( new MultiDouble(out->GetName(),results)); return true; }