20 #include <boost/property_tree/ptree.hpp> 21 #include <boost/property_tree/xml_parser.hpp> 33 const boost::property_tree::ptree &ModelTree,
36 : PartList(ParticleList), Kinematic(Kinematics), ModelTree(ModelTree),
37 TruePhspSample(TruePhspSample),
40 if (TruePhspSample.
Events.size() > 0 &&
41 RecoPhspSample.
Events.size() == 0)
42 return TruePhspSample;
50 LOG(TRACE) <<
"loading intensity...";
56 std::shared_ptr<ComPWA::FunctionTree::TreeNode> FT =
64 std::vector<ComPWA::Tools::IntensityComponent>
66 std::vector<std::vector<std::string>> ComponentList) {
67 LOG(TRACE) <<
"Creating intensity components...";
70 LOG(INFO) <<
"Components map is empty. Creating full Intensity first.";
75 std::vector<ComPWA::Tools::IntensityComponent> IntensityComponents;
77 for (
auto const &Component : ComponentList) {
78 std::string ComponentName;
81 std::pair<std::string, std::shared_ptr<ComPWA::FunctionTree::TreeNode>>>
82 NewUniqueComponentFTMapping;
84 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> FTList;
85 for (
auto const &x : Component) {
88 ComponentName +=
"_" + x;
90 Type = FindResult->second.first;
92 if (Type != FindResult->second.first) {
93 LOG(ERROR) <<
"Component " << x
94 <<
" incompatible with previous type " << Type
99 NewUniqueComponentFTMapping.insert(*FindResult);
100 FTList.push_back(FindResult->second.second);
102 LOG(ERROR) <<
"Component " << x <<
" not found! Skipping...";
105 if (FTList.size() == 0)
108 ComponentName.erase(0, 1);
110 LOG(INFO) <<
"Building component " << ComponentName;
113 if (Type ==
"Amplitude") {
114 IntensityComponents.push_back(std::make_pair(
116 std::make_shared<ComPWA::FunctionTree::FunctionTreeIntensity>(
118 LOG(INFO) <<
"as a CoherentIntensity";
120 IntensityComponents.push_back(std::make_pair(
122 std::make_shared<ComPWA::FunctionTree::FunctionTreeIntensity>(
124 LOG(INFO) <<
"as a IncoherentIntensity";
127 return IntensityComponents;
130 std::map<std::string, std::string>
132 std::map<std::string, std::string> Names;
134 Names[x.first] = x.second.first;
139 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
141 const boost::property_tree::ptree &pt,
143 LOG(TRACE) <<
"loading intensity...";
145 std::string IntensityClass(pt.get<std::string>(
"<xmlattr>.Class"));
147 std::shared_ptr<ComPWA::FunctionTree::TreeNode> FT(
nullptr);
149 if (IntensityClass ==
"IncoherentIntensity") {
151 }
else if (IntensityClass ==
"CoherentIntensity") {
153 }
else if (IntensityClass ==
"StrengthIntensity") {
155 }
else if (IntensityClass ==
"NormalizedIntensity") {
158 throw BadConfig(
"IntensityBuilderXML::createIntensityFT() | Found " 159 "unknown intensity " +
163 auto Component = pt.get_optional<std::string>(
"<xmlattr>.Component");
164 if (Component.is_initialized()) {
171 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
173 const boost::property_tree::ptree &pt,
175 LOG(TRACE) <<
"constructing IncoherentIntensity ...";
177 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> intens;
178 for (
const auto &x : pt) {
179 if (x.first ==
"Intensity") {
187 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
189 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> Intensities) {
190 LOG(TRACE) <<
"constructing IncoherentIntensity ...";
197 for (
auto x : Intensities) {
204 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
206 const boost::property_tree::ptree &pt,
208 LOG(TRACE) <<
"constructing CoherentIntensity ...";
210 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> amps;
211 for (
const auto &x : pt) {
212 if (x.first ==
"Amplitude") {
220 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
222 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> Amplitudes) {
223 LOG(TRACE) <<
"constructing CoherentIntensity ...";
226 auto tr = std::make_shared<ComPWA::FunctionTree::TreeNode>(
231 tr->addNode(SumOfAmps);
232 for (
auto x : Amplitudes) {
233 SumOfAmps->addNode(x);
239 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
241 const boost::property_tree::ptree &pt,
243 LOG(TRACE) <<
"creating StrengthIntensity ...";
245 std::shared_ptr<FitParameter> Strength(
nullptr);
246 boost::property_tree::ptree UndecoratedIntensityPT;
247 for (
const auto &x : pt) {
248 if (x.first ==
"<xmlattr>")
250 if (x.first ==
"Parameter" &&
251 x.second.get<std::string>(
"<xmlattr>.Type") ==
"Strength") {
252 Strength = std::make_shared<FitParameter>(x.second);
253 }
else if (x.first ==
"Intensity") {
254 UndecoratedIntensityPT = x.second;
256 LOG(WARNING) <<
"IntensityBuilderXML::createStrengthIntensity(): found " 265 auto tr = std::make_shared<ComPWA::FunctionTree::TreeNode>(
274 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
276 const boost::property_tree::ptree &pt,
278 LOG(TRACE) <<
"creating NormalizedIntensity ...";
280 boost::property_tree::ptree UnnormalizedPT;
281 std::string IntegratorClassName(
"MCIntegrationStrategy");
283 for (
const auto &x : pt) {
284 if (x.first ==
"<xmlattr>")
286 if (x.first ==
"Intensity") {
287 UnnormalizedPT = x.second;
288 }
else if (x.first ==
"IntegrationStrategy") {
289 auto OptionalIntegratorName =
290 pt.get_optional<std::string>(
"<xmlattr>.IntegrationStrategy");
291 if (OptionalIntegratorName.is_initialized()) {
292 IntegratorClassName = OptionalIntegratorName.get();
295 <<
"IntensityBuilderXML::createNormalizedIntensityFT(): creating " 296 "default IntegrationStrategy *MCIntegrationStrategy*";
300 <<
"IntensityBuilderXML::createNormalizedIntensityFT(): found " 309 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
311 const boost::property_tree::ptree &UnnormalizedPT,
313 std::string IntegratorClassName) {
314 LOG(TRACE) <<
"creating Normalized FunctionTree ...";
317 LOG(FATAL) <<
"IntensityBuilderXML::normalizeIntensityFT(): " 318 "reco phsp sample is not set!";
323 auto NormalizedFT = std::make_shared<ComPWA::FunctionTree::TreeNode>(
327 NormalizedFT->addNode(FTData);
337 NormalizedFT->addNode(normtree);
342 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
344 std::shared_ptr<ComPWA::FunctionTree::TreeNode> UnnormalizedIntensity,
347 double PhspWeightSum, std::string IntegratorClassName) {
348 LOG(TRACE) <<
"creating IntegrationStrategy ...";
351 std::shared_ptr<TreeNode> tr;
353 if (IntegratorClassName ==
"MCIntegrationStrategy") {
357 tr = std::make_shared<TreeNode>(
359 auto Integral = std::make_shared<TreeNode>(
361 tr->addNode(Integral);
364 createLeaf(1.0 / PhspWeightSum,
"Inverse_PhspWeightSum")});
365 auto Sum = std::make_shared<TreeNode>(
367 Integral->addNode(Sum);
368 auto WeightedIntensities = std::make_shared<TreeNode>(
370 Sum->addNode(WeightedIntensities);
373 WeightedIntensities->addNode(
createLeaf(PhspWeights));
374 WeightedIntensities->addNode(UnnormalizedIntensity);
376 LOG(WARNING) <<
"IntensityBuilderXML::createIntegrationStrategyFT(): " 377 "IntegrationStrategy type " 378 << IntegratorClassName <<
" unknown!";
384 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
386 const boost::property_tree::ptree &pt,
388 auto ampclass = pt.get<std::string>(
"<xmlattr>.Class");
390 std::shared_ptr<ComPWA::FunctionTree::TreeNode> FT(
nullptr);
392 if (ampclass ==
"HelicityDecay") {
394 }
else if (ampclass ==
"CoefficientAmplitude") {
396 }
else if (ampclass ==
"SequentialAmplitude") {
398 }
else if (ampclass ==
"NormalizedAmplitude") {
402 "IntensityBuilderXML::createAmplitude(): Unknown amplitude " +
406 auto Component = pt.get_optional<std::string>(
"<xmlattr>.Component");
407 if (Component.is_initialized()) {
414 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
416 const boost::property_tree::ptree &pt,
418 LOG(TRACE) <<
"creating NormalizedAmplitude ...";
421 LOG(FATAL) <<
"IntensityBuilderXML::createNormalizedAmplitudeFT(): " 422 "true phsp sample is not set!";
425 boost::property_tree::ptree UnnormalizedPT;
426 std::string IntegratorClassName(
"MCIntegrationStrategy");
428 for (
const auto &x : pt) {
429 if (x.first ==
"<xmlattr>")
431 if (x.first ==
"Amplitude") {
432 UnnormalizedPT = x.second;
433 }
else if (x.first ==
"IntegrationStrategy") {
434 auto OptionalIntegratorName =
435 pt.get_optional<std::string>(
"<xmlattr>.IntegrationStrategy");
436 if (OptionalIntegratorName.is_initialized()) {
437 IntegratorClassName = OptionalIntegratorName.get();
440 <<
"IntensityBuilderXML::createNormalizedAmplitudeFT(): creating " 441 "default IntegrationStrategy *MCIntegrationStrategy*";
445 <<
"IntensityBuilderXML::createNormalizedAmplitudeFT(): found " 458 NormalizedFT->addNode(FTData);
465 auto FTPhspDataAbsSquared =
467 FTPhspDataAbsSquared->addNode(FTPhspData);
469 auto normtreesquared =
474 std::make_shared<TreeNode>(std::make_shared<SquareRoot>(
ParType::DOUBLE));
476 normtree->addNode(normtreesquared);
478 NormalizedFT->addNode(normtree);
483 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
485 const boost::property_tree::ptree &pt,
487 LOG(TRACE) <<
"constructing CoefficientAmplitude ...";
489 std::shared_ptr<FitParameter> Magnitude(
nullptr);
490 std::shared_ptr<FitParameter> Phase(
nullptr);
491 auto PreFactor = std::complex<double>(1, 0);
492 bool IsPreFactorSet(
false);
493 boost::property_tree::ptree Amplitude;
494 for (
const auto &v : pt) {
495 if (v.first ==
"Parameter") {
496 if (v.second.get<std::string>(
"<xmlattr>.Type") ==
"Magnitude")
497 Magnitude = std::make_shared<FitParameter>(v.second);
498 if (v.second.get<std::string>(
"<xmlattr>.Type") ==
"Phase")
499 Phase = std::make_shared<FitParameter>(v.second);
500 }
else if (v.first ==
"PreFactor") {
501 IsPreFactorSet =
true;
502 boost::optional<double> optr =
503 v.second.get_optional<
double>(
"<xmlattr>.Magnitude");
504 if (optr.is_initialized()) {
505 double r(optr.value());
508 "IntensityBuilderXML::createCoefficientAmplitudeFT() | " 509 "PreFactor Magnitude below zero!");
511 boost::optional<double> OptPhase =
512 v.second.get_optional<
double>(
"<xmlattr>.Phase");
513 if (OptPhase.is_initialized())
514 Phase = OptPhase.value();
515 PreFactor = std::polar(r, Phase);
517 double Real = v.second.get<
double>(
"<xmlattr>.Real");
518 double Imaginary(0.0);
519 boost::optional<double> OptIm =
520 v.second.get_optional<
double>(
"<xmlattr>.Imaginary");
521 if (OptIm.is_initialized())
522 Imaginary = OptIm.value();
523 PreFactor = std::complex<double>(Real, Imaginary);
525 }
else if (v.first ==
"Amplitude") {
526 Amplitude = v.second;
527 }
else if (v.first !=
"<xmlattr>") {
528 throw BadConfig(
"IntensityBuilderXML::createCoefficientAmplitudeFT() | " 536 auto tr = std::make_shared<ComPWA::FunctionTree::TreeNode>(
538 std::make_shared<ComPWA::FunctionTree::MultAll>(
541 bool AddStrength(
true);
542 if (IsPreFactorSet) {
544 if (!Magnitude && !Phase) {
546 }
else if (!Magnitude && Phase) {
547 throw BadParameter(
"IntensityBuilderXML::createCoefficientAmplitude() | " 548 "No magnitude parameter found while phase is set.");
549 }
else if (!Phase && Magnitude)
550 throw BadParameter(
"IntensityBuilderXML::createCoefficientAmplitude() | " 551 "No phase parameter found, while magnitude is set.");
554 throw BadParameter(
"IntensityBuilderXML::createCoefficientAmplitude() | " 555 "No magnitude parameter found and no prefactor set.");
557 throw BadParameter(
"IntensityBuilderXML::createCoefficientAmplitude() | " 558 "No phase parameter found, while magnitude is set.");
565 auto Strength = std::make_shared<ComPWA::FunctionTree::TreeNode>(
566 std::make_shared<ComPWA::FunctionTree::Value<std::complex<double>>>(),
567 std::make_shared<ComPWA::FunctionTree::Complexify>(
571 tr->addNode(Strength);
578 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
580 const boost::property_tree::ptree &pt,
582 LOG(TRACE) <<
"constructing SequentialAmplitude ...";
584 std::vector<std::shared_ptr<ComPWA::FunctionTree::TreeNode>> Amplitudes;
585 for (
const auto &v : pt) {
586 if (v.first ==
"Amplitude") {
587 std::shared_ptr<ComPWA::FunctionTree::TreeNode> AmpTree =
590 Amplitudes.push_back(AmpTree);
591 }
else if (v.first !=
"<xmlattr>") {
592 throw BadConfig(
"SequentialAmplitude::createSequentialAmplitude() | " 602 for (
auto x : Amplitudes) {
611 auto decayProducts = pt.get_child(
"DecayProducts");
612 if (decayProducts.size() != 2)
613 throw boost::property_tree::ptree_error(
614 "IntensityBuilderXML::createHelicityDecayFT(): Expect exactly two " 616 std::to_string(decayProducts.size()) +
" given)!");
619 pt.get_optional<std::string>(
"RecoilSystem.<xmlattr>.RecoilFinalState");
624 auto parent_recoil = pt.get_optional<std::string>(
625 "RecoilSystem.<xmlattr>.ParentRecoilFinalState");
630 std::vector<IndexList> DecayProductStates;
631 std::vector<std::string> Names;
632 std::vector<double> Helicities;
633 for (
auto p : decayProducts) {
634 DecayProductStates.push_back(
636 Names.push_back(p.second.get<std::string>(
"<xmlattr>.Name"));
637 Helicities.push_back(p.second.get<
double>(
"<xmlattr>.Helicity"));
640 SubSystem(DecayProductStates, RecoilState, ParentRecoilState),
641 std::make_pair(Names.at(0), Names.at(1)),
642 std::make_pair(Helicities.at(0), Helicities.at(1))};
645 std::shared_ptr<ComPWA::FunctionTree::TreeNode>
647 const boost::property_tree::ptree &pt,
649 LOG(TRACE) <<
"IntensityBuilderXML::createHelicityDecayFT(): ";
652 auto KinVarNames = kin.registerSubSystem(DecayProductInfo.SubSys);
653 auto const &FinalStates = DecayProductInfo.SubSys.getFinalStates();
654 std::pair<std::string, std::string> DecayProductInvMassNames;
655 if (FinalStates.at(0).size() > 1) {
656 DecayProductInvMassNames.first =
657 kin.registerInvariantMassSquared(FinalStates.at(0));
659 if (FinalStates.at(1).size() > 1) {
660 DecayProductInvMassNames.second =
661 kin.registerInvariantMassSquared(FinalStates.at(1));
673 auto parMass1 = std::make_shared<FitParameter>(
675 auto parMass2 = std::make_shared<FitParameter>(
681 parMass1->name(), std::vector<double>{std::pow(parMass1->value(), 2)});
682 if (DecayProductInvMassNames.first !=
"") {
684 DecayProductInvMassNames.first, DataSample);
687 parMass2->name(), std::vector<double>{std::pow(parMass2->value(), 2)});
688 if (DecayProductInvMassNames.second !=
"") {
690 DecayProductInvMassNames.second, DataSample);
693 std::string name = pt.get<std::string>(
"DecayParticle.<xmlattr>.Name");
696 double J = partProp.getQuantumNumber<
double>(
"Spin");
697 double mu(pt.get<
double>(
"DecayParticle.<xmlattr>.Helicity"));
702 auto Mass = std::make_shared<FunctionTree::FitParameter>(
703 partProp.getMass().Name, partProp.getMass().Value,
704 partProp.getMass().Error.first);
705 Mass->fixParameter(partProp.getMass().IsFixed);
708 double PreFactor(1.0);
709 const auto &canoSum = pt.get_child_optional(
"CanonicalSum");
711 const auto &sumTree = canoSum.get();
712 L = sumTree.get<
unsigned int>(
"<xmlattr>.L");
713 double Coefficient = std::sqrt((2.0 * L + 1) / (2 * J + 1));
714 for (
const auto &cg : sumTree.get_child(
"")) {
715 if (cg.first !=
"ClebschGordan")
717 double j1 = cg.second.get<
double>(
"<xmlattr>.j1");
718 double m1 = cg.second.get<
double>(
"<xmlattr>.m1");
719 double j2 = cg.second.get<
double>(
"<xmlattr>.j2");
720 double m2 = cg.second.get<
double>(
"<xmlattr>.m2");
721 double J = cg.second.get<
double>(
"<xmlattr>.J");
722 double M = cg.second.get<
double>(
"<xmlattr>.M");
723 Coefficient *= ComPWA::QFT::Clebsch(j1, m1, j2, m2, J, M);
725 PreFactor *= Coefficient;
728 auto decayInfo = partProp.getDecayInfo();
729 std::string FFType(
"");
730 std::shared_ptr<Dynamics::FormFactor> FormFactor =
731 std::make_shared<Dynamics::NoFormFactor>();
732 std::shared_ptr<FitParameter> parRadius;
733 std::shared_ptr<FitParameter> Width;
734 for (
const auto &node : decayInfo.get_child(
"")) {
735 if (node.first ==
"FormFactor") {
736 FFType = node.second.get<std::string>(
"<xmlattr>.Type");
737 if (
"BlattWeisskopf" == FFType) {
739 throw std::runtime_error(
740 "createHelicityDecayFT() | Blatt-Weisskopf form factors are " 741 "implemented for L up to 4!");
742 FormFactor = std::make_shared<Dynamics::BlattWeisskopfFormFactor>();
743 }
else if (
"CrystalBarrel" == FFType) {
745 throw std::runtime_error(
746 "createHelicityDecayFT() | Crystal Barrel form factors are " 747 "implemented for L=0 only!");
748 FormFactor = std::make_shared<Dynamics::CrystalBarrelFormFactor>();
751 throw std::runtime_error(
"createHelicityDecayFT() | Form factor type " +
752 FFType +
" not specified!");
754 }
else if (node.first ==
"Parameter") {
755 std::string parType = node.second.get<std::string>(
"<xmlattr>.Type");
756 if (parType ==
"Width") {
757 Width = std::make_shared<FitParameter>(node.second);
759 }
else if (parType ==
"MesonRadius") {
760 parRadius = std::make_shared<FitParameter>(node.second);
766 std::string decayType = partProp.getDecayType();
768 std::shared_ptr<ComPWA::FunctionTree::TreeNode> DynamicFunctionFT(
nullptr);
770 if (decayType ==
"stable") {
771 throw std::runtime_error(
772 "IntensityBuilderXML::createHelicityDecayFT(): Stable particle is " 773 "given as mother particle of a decay. Makes no sense!");
774 }
else if (decayType.find(
"BreitWigner") != std::string::npos) {
777 RBW.
Type = decayType;
782 std::make_pair(InvMassDaughter1, InvMassDaughter2);
786 }
else if (decayType ==
"flatte") {
788 FlatteInfo.
Mass = Mass;
791 std::make_pair(InvMassDaughter1, InvMassDaughter2);
794 std::vector<Dynamics::Coupling> couplings;
796 for (
const auto &v : decayInfo.get_child(
"")) {
797 if (v.first !=
"Parameter")
799 std::string type = v.second.get<std::string>(
"<xmlattr>.Type");
800 if (type ==
"Coupling") {
804 if ((c.MassA->value() == parMass1->value() &&
805 c.MassB->value() == parMass2->value()) ||
806 (c.MassB->value() == parMass1->value() &&
807 c.MassA->value() == parMass2->value())) {
812 couplings.push_back(c);
818 }
else if (decayType ==
"voigt") {
821 VoigtInfo.
Mass = Mass;
822 VoigtInfo.
Width = Width;
825 std::make_pair(InvMassDaughter1, InvMassDaughter2);
828 VoigtInfo.Sigma = decayInfo.get<
double>(
"Resolution.<xmlattr>.Sigma");
830 }
else if (decayType ==
"virtual" || decayType ==
"nonResonant") {
833 throw std::runtime_error(
"HelicityDecay::Factory() | Unknown decay type " +
837 auto AngularFunction =
840 DecayProductInfo.Helicities.first -
841 DecayProductInfo.Helicities.second,
845 auto tr = std::make_shared<ComPWA::FunctionTree::TreeNode>(
848 {
createLeaf(PreFactor,
"PreFactor"), AngularFunction, DynamicFunctionFT});
851 if (FFType !=
"" && L > 0) {
852 if (parRadius ==
nullptr) {
853 throw std::runtime_error(
"IntensityBuilderXML::createHelicityDecayFT(): " 854 "No MesonRadius given for amplitude " +
856 "! It is needed to calculate the form factor!");
859 std::shared_ptr<ComPWA::FunctionTree::TreeNode> ProductionFormFactorFT =
861 parRadius, L, FormFactor, InvMassSq);
863 tr->addNode(ProductionFormFactorFT);
873 for (
auto const &x : ExemplaryDataSet.Data) {
874 std::vector<double> temp;
878 if (MDVal->name() == x.first) {
892 LOG(TRACE) <<
"updating data containers...";
901 LOG(INFO) <<
"Updating data container content...";
902 if (DataSample.
Events.size() == 0)
905 auto DataSet = Kinematics.
convert(DataSample);
909 std::stringstream ss;
910 ss <<
"IntensityBuilderXML::updateDataContainerContent(): given data " 911 "container does not have enough variables! (required: " 912 << DataList.
mDoubleValues().size() <<
", given: " << DataSet.Data.size()
914 throw std::out_of_range(ss.str());
916 for (
size_t i = 0; i < DataList.
mDoubleValues().size(); ++i) {
932 LOG(INFO) <<
"Setting phase space sample weights...";
933 std::vector<double> DataSetWeights;
934 DataSetWeights.reserve(DataSample.
Events.size());
935 double WeightSum(0.0);
936 bool UniformWeights(
true);
942 UniformWeights =
false;
944 if (!UniformWeights) {
952 std::string Name, std::string Type,
953 std::shared_ptr<ComPWA::FunctionTree::TreeNode> FT) {
956 std::make_pair(Name, std::make_pair(Type, FT)));
957 if (!InsertResult.second) {
958 LOG(ERROR) <<
"IntensityBuilderXML::addFunctionTreeComponent(): " 959 "FunctionTree with name " 960 << Name <<
" already exists!";
966 double px, py, pz, E;
968 auto tmp = pt.get_optional<
double>(
"<xmlattr>.x");
972 px = pt.get<
double>(
"x");
975 tmp = pt.get_optional<
double>(
"<xmlattr>.y");
979 py = pt.get<
double>(
"y");
982 tmp = pt.get_optional<
double>(
"<xmlattr>.z");
986 pz = pt.get<
double>(
"z");
989 tmp = pt.get_optional<
double>(
"<xmlattr>.E");
993 E = pt.get<
double>(
"E");
1001 const boost::property_tree::ptree &pt) {
1002 auto initialS = pt.get_child(
"InitialState");
1003 auto InitialState = std::vector<pid>(initialS.size());
1004 unsigned int counter(0);
1005 for (
auto i : initialS) {
1006 std::string name = i.second.get<std::string>(
"<xmlattr>.Name");
1008 unsigned int pos(counter++);
1009 boost::optional<unsigned int> opt_pos =
1010 i.second.get_optional<
unsigned int>(
"<xmlattr>.PositionIndex");
1012 pos = opt_pos.get();
1013 InitialState.at(pos) = partP.getId();
1016 auto finalS = pt.get_child(
"FinalState");
1017 auto FinalState = std::vector<pid>(finalS.size());
1018 auto FinalStateEventPositionMapping =
1019 std::vector<unsigned int>(finalS.size());
1021 for (
auto i : finalS) {
1022 std::string name = i.second.get<std::string>(
"<xmlattr>.Name");
1024 unsigned int id = i.second.get<
unsigned int>(
"<xmlattr>.Id");
1025 unsigned int pos(counter++);
1026 boost::optional<unsigned int> opt_pos =
1027 i.second.get_optional<
unsigned int>(
"<xmlattr>.PositionIndex");
1029 pos = opt_pos.get();
1030 FinalState.at(pos) = partP.getId();
1031 FinalStateEventPositionMapping.at(pos) = id;
1034 if (pt.find(
"InitialFourMomentum") != pt.not_found()) {
1035 auto InitialStateP4 =
1038 InitialState, FinalState, PartList, InitialStateP4,
1039 FinalStateEventPositionMapping);
1043 InitialState, FinalState, PartList, FinalStateEventPositionMapping);
1053 const std::string XmlFile) {
1054 boost::property_tree::ptree ptree;
1055 boost::property_tree::xml_parser::read_xml(XmlFile, ptree);
1056 auto it = ptree.find(
"HelicityKinematics");
1057 if (it != ptree.not_found()) {
1061 "HelicityKinematics tag not found in xml file!");
1067 const boost::property_tree::ptree &ptree) {
1070 auto phspVal = ptree.get_optional<
double>(
"PhspVolume");
ComPWA four momentum class.
virtual void addValue(std::shared_ptr< Parameter > value)
virtual const std::vector< pid > & getFinalStatePIDs() const =0
Get a vector of PIDs of the final state.
const EventCollection & TruePhspSample
virtual ComPWA::Data::DataSet convert(const EventCollection &Events) const =0
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createIntegrationStrategyFT(std::shared_ptr< ComPWA::FunctionTree::TreeNode > UnnormalizedIntensity, std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double >>> PhspWeights, double PhspWeightSum, std::string IntegratorClassName)
This file contains the declaration of the Voigtian class, which is used the implementation of voigt f...
boost::property_tree::ptree ModelTree
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createCoefficientAmplitudeFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
ComPWA::FitParameter< double > getMass() const
std::shared_ptr< ComPWA::FunctionTree::TreeNode > normalizeIntensityFT(const boost::property_tree::ptree &UnnormalizedPT, const ComPWA::FunctionTree::ParameterList &DataSample, std::string IntegratorClassNa)
std::shared_ptr< Value< std::vector< double > > > findMDoubleValue(const std::string &name, const ParameterList &list)
ParticleStateTransitionKinematicsInfo createKinematicsInfo(const ComPWA::ParticleList &PartList, const boost::property_tree::ptree &pt)
ParticleList readParticles(std::stringstream &Stream)
Read list of particles from a stringstream For some reason the boost xml parser needs a non-const ref...
std::vector< unsigned int > stringToVectInt(std::string str)
Helper funtions to transfor a string of space-separated numbers to a vector<unsigned int>...
void addFunctionTreeComponent(std::string Name, std::string Type, std::shared_ptr< ComPWA::FunctionTree::TreeNode > FT)
std::shared_ptr< Value< std::vector< double > > > MDouble(std::string name, size_t s, double el=0.)
std::shared_ptr< FitParameter > addUniqueParameter(std::shared_ptr< FitParameter > par)
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createIncoherentIntensityFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
const ParticleProperties & findParticle(const ParticleList &list, pid Pid)
FourMomentum createFourMomentum(const boost::property_tree::ptree &pt)
void updateDataContainerContent(ComPWA::FunctionTree::ParameterList &DataList, const EventCollection &DataSample, const Kinematics &Kinematics)
ComPWA::FunctionTree::ParameterList Data
std::map< std::string, std::string > getAllComponentNames() const
std::vector< unsigned int > IndexList
ComPWA::FunctionTree::FunctionTreeIntensity createIntensity()
std::vector< ComPWA::Tools::IntensityComponent > createIntensityComponents(std::vector< std::vector< std::string >> ComponentList={})
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createHelicityDecayFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
void updateDataContainerState()
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createCoherentIntensityFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
std::vector< Event > Events
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createIntensityFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
std::set< ParticleProperties > ParticleList
virtual std::vector< std::shared_ptr< Value< std::vector< double > > > > & mDoubleValues()
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createNormalizedAmplitudeFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
bool ComponentRegisteringEnabled
void updateDataContainerWeights(DataContainer &DataCon, const EventCollection &DataSample)
Calculates the inverse of input double values and double parameters.
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createNormalizedIntensityFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createStrengthIntensityFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createFunctionTree(InputInfo Params, std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double >>> InvMassSquared)
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createSequentialAmplitudeFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
std::shared_ptr< TreeNode > createLeaf(std::shared_ptr< Parameter > parameter)
void updateDataContainerContent()
std::shared_ptr< Value< std::vector< std::complex< double > > > > MComplex(std::string name, size_t s, std::complex< double > el=std::complex< double >(0., 0.))
ComPWA::FunctionTree::ParameterList Parameters
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createFunctionTree(std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double >>> InvMassSquaredDaughter1, std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double >>> InvMassSquaredDaughter2, std::shared_ptr< ComPWA::FunctionTree::FitParameter > MesonRadius, unsigned int L, std::shared_ptr< FormFactor > FormFactorFunctor, std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double >>> InvMassSquared)
const EventCollection & RecoPhspSample
virtual double phspVolume() const =0
The Kinematics interface defines the conversion of Events to a DataSet.
HelicityKinematics createHelicityKinematics(const std::string XmlFile)
Create HelicityKinematics object from an XML file that contains both a kinematics section and a parti...
void updateDataContainerState(ComPWA::FunctionTree::ParameterList &DataSample, const Kinematics &Kinematics)
Data structure containing all kinematic information of a physics event.
TwoBodyDecayInfo extractDecayInfo(const boost::property_tree::ptree &pt)
std::shared_ptr< ComPWA::FunctionTree::Value< std::vector< double > > > Weights
std::map< std::string, std::pair< std::string, std::shared_ptr< ComPWA::FunctionTree::TreeNode > > > UniqueComponentFTMapping
IntensityBuilderXML(ParticleList ParticleList, Kinematics &Kinematics, const boost::property_tree::ptree &ModelTree, const EventCollection &TruePhspSample={}, const EventCollection &RecoPhspSample={})
std::shared_ptr< ComPWA::FunctionTree::TreeNode > createAmplitudeFT(const boost::property_tree::ptree &pt, const ComPWA::FunctionTree::ParameterList &DataSample)
This class provides a list of parameters and values of different types.
virtual std::shared_ptr< Value< std::vector< double > > > mDoubleValue(size_t i) const
Definition of a two-body decay node within a sequential decay tree.
DataContainer PhspRecoData
Calculates the square root of input double values and double parameters.