musrFT: replace TObjArray/TObjString with PStringUtils
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+6
-13
@@ -36,13 +36,12 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <TApplication.h>
|
||||
#include <TROOT.h>
|
||||
#include <TString.h>
|
||||
#include <TObjArray.h>
|
||||
#include <TObjString.h>
|
||||
#include <TSAXParser.h>
|
||||
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
@@ -50,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#include "PMusr.h"
|
||||
#include "PStringUtils.h"
|
||||
#include "PStartupHandler.h"
|
||||
#include "PMsrHandler.h"
|
||||
#include "PRunDataHandler.h"
|
||||
@@ -234,17 +234,15 @@ Bool_t musrFT_filter_histo(Int_t &i, Int_t argc, Char_t *argv[], musrFT_startup_
|
||||
return false;
|
||||
}
|
||||
} else { // should be something like h0-hN with h0, hN numbers
|
||||
TObjArray *tok = tstr.Tokenize("-");
|
||||
if (tok->GetEntries() != 2) {
|
||||
std::vector<std::string> tok = PStringUtils::Split(tstr.Data(), "-");
|
||||
if (tok.size() != 2) {
|
||||
std::cerr << std::endl << ">> musrFT **ERROR** found --histo argument '" << tstr << "' which is not of the form <h0>-<hN>." << std::endl;
|
||||
startupParam.histo.clear();
|
||||
return false;
|
||||
}
|
||||
TObjString *ostr;
|
||||
TString sstr("");
|
||||
Int_t first=0, last=0;
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(0));
|
||||
sstr = ostr->GetString();
|
||||
sstr = tok[0];
|
||||
if (sstr.IsDigit()) {
|
||||
first = sstr.Atoi();
|
||||
} else {
|
||||
@@ -253,8 +251,7 @@ Bool_t musrFT_filter_histo(Int_t &i, Int_t argc, Char_t *argv[], musrFT_startup_
|
||||
startupParam.histo.clear();
|
||||
return false;
|
||||
}
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(1));
|
||||
sstr = ostr->GetString();
|
||||
sstr = tok[1];
|
||||
if (sstr.IsDigit()) {
|
||||
last = sstr.Atoi();
|
||||
} else {
|
||||
@@ -273,10 +270,6 @@ Bool_t musrFT_filter_histo(Int_t &i, Int_t argc, Char_t *argv[], musrFT_startup_
|
||||
for (Int_t k=first; k<=last; k++) {
|
||||
startupParam.histo.push_back(k);
|
||||
}
|
||||
|
||||
// clean up
|
||||
if (tok)
|
||||
delete tok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user