From 6753678e69c114d98f74efebdc075032f749bd14 Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Sun, 26 Jun 2022 22:06:40 -0400 Subject: [PATCH] Fix some small bugs in use of vector serialization --- .../src/Specter/Core/SpectrumSerializer.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Specter/src/Specter/Core/SpectrumSerializer.cpp b/Specter/src/Specter/Core/SpectrumSerializer.cpp index e7a2682..6f7949c 100644 --- a/Specter/src/Specter/Core/SpectrumSerializer.cpp +++ b/Specter/src/Specter/Core/SpectrumSerializer.cpp @@ -37,8 +37,8 @@ namespace Specter { { std::vector xpoints = manager.GetCutXPoints(args.name); std::vector ypoints = manager.GetCutYPoints(args.name); - output << YAML::Key << "XPoints" << YAML::Value << YAML::BeginSeq << xpoints << YAML::EndSeq; - output << YAML::Key << "YPoints" << YAML::Value << YAML::BeginSeq << ypoints << YAML::EndSeq; + output << YAML::Key << "XPoints" << YAML::Value << xpoints; + output << YAML::Key << "YPoints" << YAML::Value << ypoints; } else if (args.type == CutType::CutSummaryAll || args.type == CutType::CutSummaryAny) { @@ -46,7 +46,7 @@ namespace Specter { std::vector xpoints = manager.GetCutXPoints(args.name); output << YAML::Key << "XMin" << YAML::Value << xpoints[0]; output << YAML::Key << "XMax" << YAML::Value << xpoints[1]; - output << YAML::Key << "SubHistos" << YAML::Value << YAML::BeginSeq << subhistos << YAML::EndSeq; + output << YAML::Key << "SubHistos" << YAML::Value << subhistos; } output << YAML::EndMap; } @@ -67,10 +67,10 @@ namespace Specter { if (args.type == SpectrumType::Summary) { std::vector subhistos = SpectrumManager::GetInstance().GetSubHistograms(args.name); - output << YAML::Key << "SubHistos" << YAML::Value << YAML::BeginSeq << subhistos << YAML::EndSeq; + output << YAML::Key << "SubHistos" << YAML::Value << subhistos; } - output << YAML::Key << "CutsDrawn" << YAML::Value << YAML::BeginSeq << args.cutsDrawnUpon << YAML::EndSeq; - output << YAML::Key << "CutsApplied" << YAML::Value << YAML::BeginSeq << args.cutsAppliedTo << YAML::EndSeq; + output << YAML::Key << "CutsDrawn" << YAML::Value << args.cutsDrawnUpon; + output << YAML::Key << "CutsApplied" << YAML::Value << args.cutsAppliedTo; output << YAML::EndMap; } @@ -143,11 +143,11 @@ namespace Specter { } else if (tempArgs.type == CutType::Cut2D) { - manager.AddCut(tempArgs, cut["XPoints"][0].as>(), cut["YPoints"][0].as>()); + manager.AddCut(tempArgs, cut["XPoints"].as>(), cut["YPoints"].as>()); } else if (tempArgs.type == CutType::CutSummaryAll || tempArgs.type == CutType::CutSummaryAny) { - manager.AddCut(tempArgs, cut["SubHistos"][0].as>(), cut["XMin"].as(), cut["XMax"].as()); + manager.AddCut(tempArgs, cut["SubHistos"].as>(), cut["XMin"].as(), cut["XMax"].as()); } } } @@ -168,11 +168,11 @@ namespace Specter { tempArgs.min_y = histo["YMin"].as(); tempArgs.max_y = histo["YMax"].as(); tempArgs.nbins_y = histo["YBins"].as(); - tempArgs.cutsDrawnUpon = histo["CutsDrawn"][0].as>(); - tempArgs.cutsAppliedTo = histo["CutsApplied"][0].as>(); + tempArgs.cutsDrawnUpon = histo["CutsDrawn"].as>(); + tempArgs.cutsAppliedTo = histo["CutsApplied"].as>(); if (tempArgs.type == SpectrumType::Summary) { - manager.AddHistogramSummary(tempArgs, histo["SubHistos"][0].as>()); + manager.AddHistogramSummary(tempArgs, histo["SubHistos"].as>()); } else {