PMusrCanvas: replace TObjArray/TObjString with PStringUtils

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 15:45:24 +02:00
parent 66aa847b58
commit 5bbcb37370
+4 -12
View File
@@ -34,11 +34,11 @@
#include <TColor.h>
#include <TRandom.h>
#include <TROOT.h>
#include <TObjString.h>
#include <TGFileDialog.h>
#include "PMusrCanvas.h"
#include "PFourier.h"
#include "PStringUtils.h"
static const char *gFiletypes[] = { "Data files", "*.dat",
"All files", "*",
@@ -6408,23 +6408,15 @@ Bool_t PMusrCanvas::IsScaleN0AndBkg()
PMsrLines *cmd = fMsrHandler->GetMsrCommands();
for (UInt_t i=0; i<cmd->size(); i++) {
if (cmd->at(i).fLine.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) {
TObjArray *tokens = nullptr;
TObjString *ostr = nullptr;
TString str;
tokens = cmd->at(i).fLine.Tokenize(" \t");
if (tokens->GetEntries() != 2) {
std::vector<std::string> tokens = PStringUtils::Split(cmd->at(i).fLine.Data(), " \t");
if (tokens.size() != 2) {
std::cerr << std::endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it.";
std::cerr << std::endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << std::endl;
return willScale;
}
ostr = dynamic_cast<TObjString*>(tokens->At(1));
str = ostr->GetString();
if (!str.CompareTo("FALSE", TString::kIgnoreCase)) {
if (PStringUtils::IsEqualNoCase(tokens[1], "FALSE")) {
willScale = false;
}
// clean up
if (tokens)
delete tokens;
}
}