|
18 | 18 | #include <CommonConstants/LHCConstants.h> |
19 | 19 | #include <CommonDataFormat/IRFrame.h> |
20 | 20 | #include <CommonDataFormat/InteractionRecord.h> |
| 21 | +#include <CommonUtils/StringUtils.h> |
21 | 22 | #include <Framework/HistogramRegistry.h> |
22 | 23 | #include <Framework/HistogramSpec.h> |
23 | 24 | #include <Framework/Logger.h> |
@@ -198,24 +199,18 @@ std::vector<int> Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber |
198 | 199 | mLastSelectedIdx = 0; |
199 | 200 | mTOIs.clear(); |
200 | 201 | mTOIidx.clear(); |
201 | | - while (!tois.empty()) { |
202 | | - size_t pos = tois.find(","); |
203 | | - pos = (pos == std::string::npos) ? tois.size() : pos; |
204 | | - std::string token = tois.substr(0, pos); |
205 | | - // Trim leading and trailing whitespaces from the token |
206 | | - token.erase(0, token.find_first_not_of(" ")); |
207 | | - token.erase(token.find_last_not_of(" ") + 1); |
| 202 | + std::vector<std::string> tokens = o2::utils::Str::tokenize(tois, ','); // tokens are trimmed |
| 203 | + for (auto const& token : tokens) { |
208 | 204 | int bin = findBin(mSelections, token) - 2; |
209 | 205 | mTOIs.push_back(token); |
210 | 206 | mTOIidx.push_back(bin); |
211 | | - tois = tois.erase(0, pos + 1); |
212 | 207 | } |
213 | 208 | mTOIcounts.resize(mTOIs.size(), 0); |
214 | 209 | LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber); |
215 | 210 | for (size_t i{0}; i < mTOIs.size(); ++i) { |
216 | 211 | LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]); |
217 | 212 | } |
218 | | - mZorroSummary.setupTOIs(mTOIs.size(), tois); |
| 213 | + mZorroSummary.setupTOIs(mTOIs.size(), mTOIs); |
219 | 214 | std::vector<double> toiCounters(mTOIs.size(), 0.); |
220 | 215 | for (size_t i{0}; i < mTOIs.size(); ++i) { |
221 | 216 | toiCounters[i] = mSelections->GetBinContent(mTOIidx[i] + 2); |
|
0 commit comments