|
68 | 68 | #include <RtypesCore.h> |
69 | 69 |
|
70 | 70 | #include <algorithm> |
| 71 | +#include <charconv> |
71 | 72 | #include <chrono> |
72 | 73 | #include <cmath> |
73 | 74 | #include <cstdint> |
|
78 | 79 | #include <map> |
79 | 80 | #include <memory> |
80 | 81 | #include <string> |
| 82 | +#include <system_error> |
81 | 83 | #include <utility> |
82 | 84 | #include <variant> |
83 | 85 | #include <vector> |
@@ -1511,7 +1513,7 @@ struct AnalysisSameEventPairing { |
1511 | 1513 | o2::framework::Configurable<std::string> fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; |
1512 | 1514 | o2::framework::Configurable<std::string> fConfigMixingVariablesJson{"cfgMixingVarsJSON", "", "Mixing configs in JSON format"}; |
1513 | 1515 | o2::framework::Configurable<bool> fConfigRunMixingAcrossTFs{"cfgRunMixingAcrossTFs", false, "If true, run event mixing using the MixingHandler which accumulates events across multiple TFs"}; |
1514 | | - o2::framework::Configurable<std::string> fConfigMixingNSelEdges{"cfgMixingNSelEdges", "", "Comma separated class edges in the number of selected pairing tracks per event"}; |
| 1516 | + o2::framework::Configurable<std::string> fConfigMixingNSelEdges{"cfgMixingNSelEdges", "", "Comma separated class edges in the number of selected pairing tracks per event, (e.g. 2,3,4,1000)"}; |
1515 | 1517 | // o2::framework::Configurable<std::string> fConfigAddEventMixingHistogram{"cfgAddEventMixingHistogram", "", "Comma separated list of histograms"}; |
1516 | 1518 | o2::framework::Configurable<std::string> fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; |
1517 | 1519 | o2::framework::Configurable<std::string> fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; |
@@ -1865,7 +1867,16 @@ struct AnalysisSameEventPairing { |
1865 | 1867 | if (!fConfigMixingNSelEdges.value.empty()) { |
1866 | 1868 | std::unique_ptr<TObjArray> edgeArr(TString(fConfigMixingNSelEdges.value).Tokenize(",")); |
1867 | 1869 | for (int ie = 0; ie < edgeArr->GetEntries(); ++ie) { |
1868 | | - fMixNSelEdges.push_back(static_cast<TObjString*>(edgeArr->At(ie))->GetString().Atoi()); |
| 1870 | + const std::string edgeStr = dynamic_cast<TObjString*>(edgeArr->At(ie))->GetString().Data(); |
| 1871 | + int edge = 0; |
| 1872 | + const auto [ptr, ec] = std::from_chars(edgeStr.data(), edgeStr.data() + edgeStr.size(), edge); |
| 1873 | + if (ec != std::errc() || ptr != edgeStr.data() + edgeStr.size()) { |
| 1874 | + LOG(fatal) << "Edges must be integers: '" << fConfigMixingNSelEdges.value << "'"; |
| 1875 | + } |
| 1876 | + fMixNSelEdges.push_back(edge); |
| 1877 | + } |
| 1878 | + if (fMixNSelEdges.size() < 2 || !std::is_sorted(fMixNSelEdges.begin(), fMixNSelEdges.end()) || std::adjacent_find(fMixNSelEdges.begin(), fMixNSelEdges.end()) != fMixNSelEdges.end()) { |
| 1879 | + LOG(fatal) << "cfgMixingNSelEdges needs at least two edges in strictly increasing order: '" << fConfigMixingNSelEdges.value << "'"; |
1869 | 1880 | } |
1870 | 1881 | LOGF(info, "Event mixing restricted to classes of selected pairing tracks per event: %s", fConfigMixingNSelEdges.value.c_str()); |
1871 | 1882 | } |
|
0 commit comments