13 #include "TParameter.h" 22 const std::string &filename,
const std::string &option)
23 : RootFile(filename.c_str(), option.c_str()) {
28 RootFile.mkdir(
"final_state_id_to_name_mapping")->cd();
30 TParameter<int> TempPar(x.second.c_str(), x.first);
43 double EventWeight(1.0);
45 double DataIntegral(0.0);
47 TTree tree(TreeName.c_str(), TreeName.c_str());
48 std::vector<double> DataPointValues(DataSample.
Data.size(), 0.0);
49 auto iter = DataSample.
Data.begin();
50 for (
size_t i = 0; i < DataSample.
Data.size(); ++i) {
51 tree.Branch(iter->first.c_str(), &DataPointValues.at(i),
52 (iter->first +
"/D").c_str());
55 tree.Branch(
"weight", &EventWeight,
"event_weight/D");
58 for (
size_t i = 0; i < DataSample.
Weights.size(); ++i) {
59 EventWeight = DataSample.
Weights[i];
61 iter = DataSample.
Data.begin();
62 for (
size_t j = 0; j < DataPointValues.size(); ++j) {
63 DataPointValues[j] = iter->second[i];
67 DataIntegral += DataSample.
Weights[i];
75 std::string TreeName) {
82 std::map<std::string, std::shared_ptr<ComPWA::Intensity>>
83 IntensityComponents) {
85 LOG(INFO) <<
"RootPlotData::write | calculating total intensity integral" 86 " using phase space sample...";
95 TTree tree((TreeName +
"_WeightedPhspMCSample").c_str(),
96 (TreeName +
"_WeightedPhspMCSample").c_str());
97 double EventWeight(1.0);
99 std::vector<double> DataPointValues(PhspSample.
Data.size(), 0.0);
100 auto iter = PhspSample.
Data.begin();
101 for (
size_t i = 0; i < PhspSample.
Data.size(); ++i) {
102 tree.Branch(iter->first.c_str(), &DataPointValues.at(i),
103 (iter->first +
"/D").c_str());
106 tree.Branch(
"weight", &EventWeight,
"event_weight/D");
108 double IntensityWeight(0.0);
109 tree.Branch(
"intensity", &IntensityWeight,
"intensity/D");
110 std::vector<double> AmplitudeComponentWeights =
111 std::vector<double>(IntensityComponents.size(), 0.0);
112 unsigned int counter(0);
113 for (
auto const & : IntensityComponents) {
114 tree.Branch(amp.first.c_str(), &AmplitudeComponentWeights.at(counter),
115 (amp.first +
"/D").c_str());
120 std::vector<std::vector<double>> Components;
121 for (
auto amp : IntensityComponents) {
122 Components.push_back(amp.second->evaluate(PhspSample.
Data));
126 for (
size_t i = 0; i < PhspSample.
Weights.size(); ++i) {
127 EventWeight = PhspSample.
Weights[i];
129 iter = PhspSample.
Data.begin();
130 for (
size_t j = 0; j < DataPointValues.size(); ++j) {
131 DataPointValues[j] = iter->second[i];
134 IntensityWeight = Intensities[i];
135 for (
size_t j = 0; j < Components.size(); ++j) {
136 AmplitudeComponentWeights[j] = Components[j][i];
146 std::string TreeName) {
std::vector< double > Weights
std::map< unsigned int, std::string > getFinalStateIDToNameMapping() const
virtual OutputType evaluate(const InputTypes &... args) noexcept=0
Interface template for a general Function of the form OutputType Function(InputTypes) The concept clo...