From 6b94907e4cb7d7a500073464be23669870125964 Mon Sep 17 00:00:00 2001 From: camolezi Date: Mon, 22 Jun 2020 21:04:32 +0200 Subject: [PATCH 1/2] replaced boost regex dependency for stl regex --- CommonTools/Utils/src/TFileDirectory.cc | 8 ++--- CondCore/CondDB/interface/Utils.h | 20 ++++++------ .../Trigger/plugins/HLTMuonRefMethod.cc | 8 ++--- .../StreamerIO/plugins/DQMFileIterator.cc | 8 ++--- .../StreamerIO/plugins/RamdiskMonitor.cc | 8 ++--- .../PatCandidates/interface/EventHypothesis.h | 6 ++-- .../L1TRawToDigi/interface/MP7FileReader.h | 12 +++---- EventFilter/L1TRawToDigi/src/MP7FileReader.cc | 32 +++++++++---------- .../L1TRawToDigi/src/MP7PacketReader.cc | 1 + .../doc/EventSelector.cc-with-cerr-traces | 6 ++-- Fireworks/Core/src/FWFileEntry.cc | 18 +++++------ Fireworks/Core/src/FWHLTTriggerTableView.cc | 6 ++-- Fireworks/Core/src/FWHLTValidator.cc | 4 +-- Fireworks/Core/src/FWL1TriggerTableView.cc | 8 ++--- Fireworks/Core/src/expressionFormatHelpers.cc | 7 ++-- .../Timer/plugins/FastTimerServiceClient.cc | 20 ++++++------ .../Timer/plugins/ThroughputServiceClient.cc | 6 ++-- PhysicsTools/FWLite/src/TH1Store.cc | 8 ++--- .../src/PixelCPEClusterRepair.cc | 6 ++-- .../plugins/TrackerTrackHitFilter.cc | 12 +++---- 20 files changed, 103 insertions(+), 101 deletions(-) diff --git a/CommonTools/Utils/src/TFileDirectory.cc b/CommonTools/Utils/src/TFileDirectory.cc index aff2f0751f315..db5ec8f945bd1 100644 --- a/CommonTools/Utils/src/TFileDirectory.cc +++ b/CommonTools/Utils/src/TFileDirectory.cc @@ -3,7 +3,7 @@ #include "CommonTools/Utils/interface/TFileDirectory.h" -#include "boost/regex.hpp" +#include using namespace std; @@ -75,11 +75,11 @@ TDirectory *TFileDirectory::_mkdir(TDirectory *dirPtr, const string &subdirName, } // if we're here, then this directory doesn't exist. Is this // directory a subdirectory? - const boost::regex subdirRE("(.+?)/([^/]+)"); - boost::smatch matches; + const std::regex subdirRE("(.+?)/([^/]+)"); + std::smatch matches; TDirectory *parentDir = nullptr; string useName = subdirName; - if (boost::regex_match(subdirName, matches, subdirRE)) { + if (std::regex_match(subdirName, matches, subdirRE)) { parentDir = _mkdir(dirPtr, matches[1], description); useName = matches[2]; } else { diff --git a/CondCore/CondDB/interface/Utils.h b/CondCore/CondDB/interface/Utils.h index aa40dd3622944..1789058bcc086 100644 --- a/CondCore/CondDB/interface/Utils.h +++ b/CondCore/CondDB/interface/Utils.h @@ -13,7 +13,7 @@ #include #include // -#include +#include namespace cond { @@ -123,10 +123,10 @@ namespace cond { if (input.find("sqlite") == 0 || input.find("oracle") == 0) return input; - //static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); - static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); - static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); - static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); + //static const std::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); + static const std::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); + static const std::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); + static const std::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); static const std::map frontierMap = { {"PromptProd", "cms_orcon_adg"}, @@ -136,23 +136,23 @@ namespace cond { {"FrontierPrep", "cms_orcoff_prep"}, }; - boost::smatch matches; + std::smatch matches; static const std::string technology("oracle://"); std::string service(""); std::string account(""); bool match = false; - if (boost::regex_match(input, matches, short_frontier)) { + if (std::regex_match(input, matches, short_frontier)) { service = matches[1]; account = matches[2]; match = true; } - if (boost::regex_match(input, matches, long_frontier)) { + if (std::regex_match(input, matches, long_frontier)) { std::string frontier_config(matches[1]); - boost::smatch matches2; - if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl)) + std::smatch matches2; + if (not std::regex_search(frontier_config, matches2, long_frontier_serverurl)) throwException("No serverurl in matched long frontier", "convertoToOracleConnection"); service = matches2[1]; account = matches[3]; diff --git a/DQMOffline/Trigger/plugins/HLTMuonRefMethod.cc b/DQMOffline/Trigger/plugins/HLTMuonRefMethod.cc index 7e533c1541ab2..62f0bfc5d0643 100644 --- a/DQMOffline/Trigger/plugins/HLTMuonRefMethod.cc +++ b/DQMOffline/Trigger/plugins/HLTMuonRefMethod.cc @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -70,8 +70,8 @@ void HLTMuonRefMethod::beginJob() {} void HLTMuonRefMethod::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) { using vstring = std::vector; - boost::regex metacharacters{"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"}; - boost::smatch what; + std::regex metacharacters{"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"}; + std::smatch what; // theDQM = 0; // theDQM = Service().operator->(); @@ -85,7 +85,7 @@ void HLTMuonRefMethod::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& if (subDir[subDir.size() - 1] == '/') subDir.erase(subDir.size() - 1); - if (boost::regex_search(subDir, what, metacharacters)) { + if (std::regex_search(subDir, what, metacharacters)) { const string::size_type shiftPos = subDir.rfind('/'); const string searchPath = subDir.substr(0, shiftPos); const string pattern = subDir.substr(shiftPos + 1, subDir.length()); diff --git a/DQMServices/StreamerIO/plugins/DQMFileIterator.cc b/DQMServices/StreamerIO/plugins/DQMFileIterator.cc index 8240fceb9ba40..3874b372744d3 100644 --- a/DQMServices/StreamerIO/plugins/DQMFileIterator.cc +++ b/DQMServices/StreamerIO/plugins/DQMFileIterator.cc @@ -2,7 +2,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/TimeOfDay.h" -#include +#include #include #include #include @@ -231,7 +231,7 @@ namespace dqmservices { directory_iterator dend; for (directory_iterator di(runPath); di != dend; ++di) { - const boost::regex fn_re("run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn"); + const std::regex fn_re("run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn"); const std::string filename = di->path().filename().string(); const std::string fn = di->path().string(); @@ -240,8 +240,8 @@ namespace dqmservices { continue; } - boost::smatch result; - if (boost::regex_match(filename, result, fn_re)) { + std::smatch result; + if (std::regex_match(filename, result, fn_re)) { unsigned int run = std::stoi(result[1]); unsigned int lumi = std::stoi(result[2]); std::string label = result[3]; diff --git a/DQMServices/StreamerIO/plugins/RamdiskMonitor.cc b/DQMServices/StreamerIO/plugins/RamdiskMonitor.cc index d722c7ac7d4c0..544bccb0c1e30 100644 --- a/DQMServices/StreamerIO/plugins/RamdiskMonitor.cc +++ b/DQMServices/StreamerIO/plugins/RamdiskMonitor.cc @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -181,7 +181,7 @@ namespace dqm { directory_iterator dend; for (directory_iterator di(runPath_); di != dend; ++di) { - const boost::regex fn_re("run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn"); + const std::regex fn_re("run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn"); const std::string filename = di->path().filename().string(); const std::string fn = di->path().string(); @@ -190,8 +190,8 @@ namespace dqm { continue; } - boost::smatch result; - if (boost::regex_match(filename, result, fn_re)) { + std::smatch result; + if (std::regex_match(filename, result, fn_re)) { unsigned int run = std::stoi(result[1]); unsigned int lumi = std::stoi(result[2]); std::string label = result[3]; diff --git a/DataFormats/PatCandidates/interface/EventHypothesis.h b/DataFormats/PatCandidates/interface/EventHypothesis.h index 3bcc4741a3ae8..6d5329008f8c1 100644 --- a/DataFormats/PatCandidates/interface/EventHypothesis.h +++ b/DataFormats/PatCandidates/interface/EventHypothesis.h @@ -3,7 +3,7 @@ #include "DataFormats/Candidate/interface/CandidateFwd.h" #include "DataFormats/Candidate/interface/Candidate.h" -#include +#include #include #include @@ -131,11 +131,11 @@ namespace pat { public: explicit RoleRegexpFilter(const std::string &roleRegexp) : re_(roleRegexp) {} bool operator()(const CandRefType &cand, const std::string &role) const override { - return boost::regex_match(role, re_); + return std::regex_match(role, re_); } private: - boost::regex re_; + std::regex re_; }; } // namespace eventhypothesis diff --git a/EventFilter/L1TRawToDigi/interface/MP7FileReader.h b/EventFilter/L1TRawToDigi/interface/MP7FileReader.h index d568c0a0bc229..738ea741c6312 100644 --- a/EventFilter/L1TRawToDigi/interface/MP7FileReader.h +++ b/EventFilter/L1TRawToDigi/interface/MP7FileReader.h @@ -16,7 +16,7 @@ #include // Boost Headers -#include +#include class FileData { public: @@ -89,11 +89,11 @@ class MP7FileReader { std::vector buffers_; private: - static boost::regex reBoard_; - static boost::regex reLink_; - static boost::regex reQuadChan_; - static boost::regex reFrame_; - static boost::regex reValid_; + static std::regex reBoard_; + static std::regex reLink_; + static std::regex reQuadChan_; + static std::regex reFrame_; + static std::regex reValid_; }; #endif /* READER_H */ diff --git a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc index 2427fcf26c9a7..258b0474e8a7d 100644 --- a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc +++ b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc @@ -4,7 +4,7 @@ #include "EventFilter/L1TRawToDigi/interface/MP7FileReader.h" #include -#include +#include #include #include @@ -15,11 +15,11 @@ using std::cout; using std::endl; // Constants initialization -boost::regex MP7FileReader::reBoard_("^Board (.+)"); -boost::regex MP7FileReader::reLink_("^Link : (.*)"); -boost::regex MP7FileReader::reQuadChan_("^Quad/Chan : (.*)"); -boost::regex MP7FileReader::reFrame_("^Frame (\\d{4}) : (.*)"); -boost::regex MP7FileReader::reValid_("([01])v([0-9a-fA-F]{8})"); +std::regex MP7FileReader::reBoard_("^Board (.+)"); +std::regex MP7FileReader::reLink_("^Link : (.*)"); +std::regex MP7FileReader::reQuadChan_("^Quad/Chan : (.*)"); +std::regex MP7FileReader::reFrame_("^Frame (\\d{4}) : (.*)"); +std::regex MP7FileReader::reValid_("([01])v([0-9a-fA-F]{8})"); //____________________________________________________________________________// const std::vector& FileData::link(uint32_t i) const { @@ -116,7 +116,7 @@ void MP7FileReader::load() { std::string MP7FileReader::searchBoard() { std::string line; std::string id; - boost::smatch what; + std::smatch what; while (getline(file_, line)) { // Trim and skip empties and comments @@ -126,7 +126,7 @@ std::string MP7FileReader::searchBoard() { if (line[0] == '#') continue; - if (boost::regex_match(line, what, reBoard_)) { + if (std::regex_match(line, what, reBoard_)) { // Create a new buffer snapshot id = what[1]; return id; @@ -142,7 +142,7 @@ std::string MP7FileReader::searchBoard() { //____________________________________________________________________________// std::vector MP7FileReader::searchLinks() { std::string line; - boost::smatch what; + std::smatch what; while (getline(file_, line)) { boost::trim(line); @@ -151,12 +151,12 @@ std::vector MP7FileReader::searchLinks() { if (line[0] == '#') continue; - if (boost::regex_match(line, what, reQuadChan_)) { + if (std::regex_match(line, what, reQuadChan_)) { // Not used continue; } - if (boost::regex_match(line, what, reLink_)) { + if (std::regex_match(line, what, reLink_)) { std::vector tokens; std::string tmp = what[1].str(); // Trim the line @@ -176,8 +176,8 @@ std::vector MP7FileReader::searchLinks() { } uint64_t MP7FileReader::validStrToUint64(const std::string& token) { - boost::smatch what; - if (!boost::regex_match(token, what, reValid_)) { + std::smatch what; + if (!std::regex_match(token, what, reValid_)) { throw std::logic_error("Token '" + token + "' doesn't match the valid format"); } @@ -189,17 +189,17 @@ uint64_t MP7FileReader::validStrToUint64(const std::string& token) { //____________________________________________________________________________// std::vector > MP7FileReader::readRows() { std::string line; - boost::smatch what; + std::smatch what; std::vector > data; int place = file_.tellg(); while (getline(file_, line)) { - if (boost::regex_match(line, what, reBoard_)) { + if (std::regex_match(line, what, reBoard_)) { // Upos, next board found. Go back by one line file_.seekg(place); return data; } - if (boost::regex_match(line, what, reFrame_)) { + if (std::regex_match(line, what, reFrame_)) { // check frame number uint32_t n = boost::lexical_cast(what[1].str()); diff --git a/EventFilter/L1TRawToDigi/src/MP7PacketReader.cc b/EventFilter/L1TRawToDigi/src/MP7PacketReader.cc index 4fc26d8af51d0..1460d28763058 100644 --- a/EventFilter/L1TRawToDigi/src/MP7PacketReader.cc +++ b/EventFilter/L1TRawToDigi/src/MP7PacketReader.cc @@ -1,6 +1,7 @@ #include "EventFilter/L1TRawToDigi/interface/MP7PacketReader.h" #include +#include using std::cout; using std::endl; diff --git a/FWCore/Framework/doc/EventSelector.cc-with-cerr-traces b/FWCore/Framework/doc/EventSelector.cc-with-cerr-traces index 78c391d2c8549..b95ce4e002bfe 100644 --- a/FWCore/Framework/doc/EventSelector.cc-with-cerr-traces +++ b/FWCore/Framework/doc/EventSelector.cc-with-cerr-traces @@ -13,7 +13,7 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "boost/algorithm/string.hpp" -#include "boost/regex.hpp" +#include #include #include // ### @@ -350,10 +350,10 @@ namespace edm EventSelector::matching_triggers(Strings const& trigs, std::string const& s) { std::vector< Strings::const_iterator > m; - boost::regex r ( glob2reg(s) ); + std::regex r ( glob2reg(s) ); for (Strings::const_iterator i = trigs.begin(); i != trigs.end(); ++i) { - if (boost::regex_match((*i),r)) + if (std::regex_match((*i),r)) { m.push_back(i); } diff --git a/Fireworks/Core/src/FWFileEntry.cc b/Fireworks/Core/src/FWFileEntry.cc index df0abd663f913..6c22c952b89cd 100644 --- a/Fireworks/Core/src/FWFileEntry.cc +++ b/Fireworks/Core/src/FWFileEntry.cc @@ -1,4 +1,4 @@ -#include +#include #include "TFile.h" #include "TEveTreeTools.h" @@ -346,9 +346,9 @@ void FWFileEntry::runFilter(Filter* filter, const FWEventItemsManager* eiMng) { item->setEvent(nullptr); } - boost::regex re(std::string("\\$") + (*i)->name()); + std::regex re(std::string("\\$") + (*i)->name()); - if (boost::regex_search(interpretedSelection, re)) { + if (std::regex_search(interpretedSelection, re)) { const edm::TypeWithDict elementType(const_cast(item->type())); const edm::TypeWithDict wrapperType = edm::TypeWithDict::byName(edm::wrappedClassName(elementType.name())); std::string fullBranchName = m_event->getBranchNameFor(wrapperType.typeInfo(), @@ -356,7 +356,7 @@ void FWFileEntry::runFilter(Filter* filter, const FWEventItemsManager* eiMng) { item->productInstanceLabel().c_str(), item->processName().c_str()); - interpretedSelection = boost::regex_replace(interpretedSelection, re, fullBranchName + ".obj"); + interpretedSelection = std::regex_replace(interpretedSelection, re, fullBranchName + ".obj"); branch_names.push_back(fullBranchName); @@ -456,8 +456,8 @@ void FWFileEntry::runFilter(Filter* filter, const FWEventItemsManager* eiMng) { bool FWFileEntry::filterEventsWithCustomParser(Filter* filterEntry) { std::string selection(filterEntry->m_selector->m_expression); - boost::regex re_spaces("\\s+"); - selection = boost::regex_replace(selection, re_spaces, ""); + std::regex re_spaces("\\s+"); + selection = std::regex_replace(selection, re_spaces, ""); if (selection.find("&&") != std::string::npos && selection.find("||") != std::string::npos) { // Combination of && and || operators not supported. return false; @@ -483,10 +483,10 @@ bool FWFileEntry::filterEventsWithCustomParser(Filter* filterEntry) { if (selection.find("||") != std::string::npos) junction_mode = false; // OR - boost::regex re("\\&\\&|\\|\\|"); + std::regex re("\\&\\&|\\|\\|"); - boost::sregex_token_iterator i(selection.begin(), selection.end(), re, -1); - boost::sregex_token_iterator j; + std::sregex_token_iterator i(selection.begin(), selection.end(), re, -1); + std::sregex_token_iterator j; // filters and how they enter in the logical expression std::vector> filters; diff --git a/Fireworks/Core/src/FWHLTTriggerTableView.cc b/Fireworks/Core/src/FWHLTTriggerTableView.cc index b6a3d1f2bd7c6..770fe30bcdaf0 100644 --- a/Fireworks/Core/src/FWHLTTriggerTableView.cc +++ b/Fireworks/Core/src/FWHLTTriggerTableView.cc @@ -9,7 +9,7 @@ // Original Author: // Created: Tue Jan 25 16:02:03 CET 2011 // -#include +#include #include "Fireworks/Core/interface/FWHLTTriggerTableView.h" #include "Fireworks/Core/interface/fwLog.h" @@ -45,9 +45,9 @@ void FWHLTTriggerTableView::fillTable(fwlite::Event* event) { m_tableManager->dataChanged(); return; } - boost::regex filter(m_regex.value()); + std::regex filter(m_regex.value()); for (unsigned int i = 0; i < triggerNames->size(); ++i) { - if (!boost::regex_search(triggerNames->triggerName(i), filter)) + if (!std::regex_search(triggerNames->triggerName(i), filter)) continue; m_columns.at(0).values.push_back(triggerNames->triggerName(i)); m_columns.at(1).values.push_back(Form("%d", hTriggerResults->accept(i))); diff --git a/Fireworks/Core/src/FWHLTValidator.cc b/Fireworks/Core/src/FWHLTValidator.cc index 48ace9d0b38b0..b23f257ec0488 100644 --- a/Fireworks/Core/src/FWHLTValidator.cc +++ b/Fireworks/Core/src/FWHLTValidator.cc @@ -7,7 +7,7 @@ // system include files #include #include -#include +#include // user include files #include "Fireworks/Core/interface/FWHLTValidator.h" @@ -25,7 +25,7 @@ void FWHLTValidator::fillOptions(const char* iBegin, std::vector, std::string> >& oOptions) const { oOptions.clear(); std::string part(iBegin, iEnd); - part = boost::regex_replace(part, boost::regex(".*?(\\&\\&|\\|\\||\\s)+"), ""); + part = std::regex_replace(part, std::regex(".*?(\\&\\&|\\|\\||\\s)+"), ""); if (m_triggerNames.empty()) { edm::Handle hTriggerResults; diff --git a/Fireworks/Core/src/FWL1TriggerTableView.cc b/Fireworks/Core/src/FWL1TriggerTableView.cc index 5d7d8eecf9b04..279b0e8a92769 100644 --- a/Fireworks/Core/src/FWL1TriggerTableView.cc +++ b/Fireworks/Core/src/FWL1TriggerTableView.cc @@ -10,7 +10,7 @@ // Created: Tue Jan 25 16:02:11 CET 2011 // -#include +#include #include "Fireworks/Core/interface/FWL1TriggerTableView.h" #include "Fireworks/Core/interface/fwLog.h" @@ -52,7 +52,7 @@ void FWL1TriggerTableView::fillTable(fwlite::Event* event) { int pfIndexTechTrig = -1; int pfIndexAlgoTrig = -1; - boost::regex filter(m_regex.value()); + std::regex filter(m_regex.value()); /// prescale factors std::vector > prescaleFactorsAlgoTrig = triggerMenuLite->gtPrescaleFactorsAlgoTrig(); @@ -83,7 +83,7 @@ void FWL1TriggerTableView::fillTable(fwlite::Event* event) { int errorCode = 0; const bool result = triggerMenuLite->gtTriggerResult(aName, dWord, errorCode); - if (!boost::regex_search(aName, filter)) + if (!std::regex_search(aName, filter)) continue; m_columns.at(0).values.push_back(aName); @@ -102,7 +102,7 @@ void FWL1TriggerTableView::fillTable(fwlite::Event* event) { int tBitNumber = 0; int tBitResult = 0; - if (boost::regex_search(kTechTriggerName, filter)) { + if (std::regex_search(kTechTriggerName, filter)) { for (TechnicalTriggerWord::const_iterator tBitIt = ttWord.begin(), tBitEnd = ttWord.end(); tBitIt != tBitEnd; ++tBitIt, ++tBitNumber) { if (*tBitIt) diff --git a/Fireworks/Core/src/expressionFormatHelpers.cc b/Fireworks/Core/src/expressionFormatHelpers.cc index 52a3649f484bd..075c8d3aa5634 100644 --- a/Fireworks/Core/src/expressionFormatHelpers.cc +++ b/Fireworks/Core/src/expressionFormatHelpers.cc @@ -11,7 +11,8 @@ // // system include files -#include +#include +#include // user include files #include "Fireworks/Core/src/expressionFormatHelpers.h" @@ -25,9 +26,9 @@ namespace fireworks { std::string oldToNewFormat(const std::string& iExpression) { //Backwards compatibility with old format: If find a $. or a () just remove them const std::string variable; - static boost::regex const reVarName("(\\$\\.)|(\\(\\))"); + static std::regex const reVarName("(\\$\\.)|(\\(\\))"); - return boost::regex_replace(iExpression, reVarName, variable); + return std::regex_replace(iExpression, reVarName, variable); } long indexFromNewFormatToOldFormat(const std::string& iNewFormat, diff --git a/HLTrigger/Timer/plugins/FastTimerServiceClient.cc b/HLTrigger/Timer/plugins/FastTimerServiceClient.cc index 2c6ad2794ec4e..c2e13be22056e 100644 --- a/HLTrigger/Timer/plugins/FastTimerServiceClient.cc +++ b/HLTrigger/Timer/plugins/FastTimerServiceClient.cc @@ -3,7 +3,7 @@ #include // boost headers -#include +#include // Root headers #include @@ -100,13 +100,13 @@ void FastTimerServiceClient::fillSummaryPlots(DQMStore::IBooker& booker, DQMStor // the plots are directly in the configured folder fillProcessSummaryPlots(booker, getter, m_dqm_path); } else { - static const boost::regex running_n_processes(".*/Running .*"); + static const std::regex running_n_processes(".*/Running .*"); booker.setCurrentFolder(m_dqm_path); std::vector subdirs = getter.getSubdirs(); for (auto const& subdir : subdirs) { // the plots are in a per-number-of-processes folder - if (boost::regex_match(subdir, running_n_processes)) { + if (std::regex_match(subdir, running_n_processes)) { booker.setCurrentFolder(subdir); if (getter.get(subdir + "/event time_real")) fillProcessSummaryPlots(booker, getter, subdir); @@ -141,12 +141,12 @@ void FastTimerServiceClient::fillProcessSummaryPlots(DQMStore::IBooker& booker, double events = me->getTH1F()->GetEntries(); // look for per-process directories - static const boost::regex process_name(".*/process .*"); + static const std::regex process_name(".*/process .*"); booker.setCurrentFolder(current_path); // ?!?!? std::vector subdirs = getter.getSubdirs(); for (auto const& subdir : subdirs) { - if (boost::regex_match(subdir, process_name)) { + if (std::regex_match(subdir, process_name)) { getter.setCurrentFolder(subdir); // look for per-path plots inside each per-process directory std::vector subsubdirs = getter.getSubdirs(); @@ -189,8 +189,8 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, if (subsubdir.find(test) == std::string::npos) continue; - static const boost::regex prefix(current_path + "/path "); - std::string path = boost::regex_replace(subsubdir, prefix, ""); + static const std::regex prefix(current_path + "/path "); + std::string path = std::regex_replace(subsubdir, prefix, ""); paths_time->setBinLabel(ibin, path); paths_thread->setBinLabel(ibin, path); @@ -366,14 +366,14 @@ void FastTimerServiceClient::fillPlotsVsLumi(DQMStore::IBooker& booker, MEPSet pset) { std::vector menames; - static const boost::regex byls(".*byls"); - static const boost::regex test(suffix); + static const std::regex byls(".*byls"); + static const std::regex test(suffix); // get all MEs in the current_path getter.setCurrentFolder(current_path); std::vector allmenames = getter.getMEs(); for (auto const& m : allmenames) { // get only MEs vs LS - if (boost::regex_match(m, byls)) + if (std::regex_match(m, byls)) menames.push_back(m); } // if no MEs available, return diff --git a/HLTrigger/Timer/plugins/ThroughputServiceClient.cc b/HLTrigger/Timer/plugins/ThroughputServiceClient.cc index 12f9f55ce4280..a8f4ceeec1595 100644 --- a/HLTrigger/Timer/plugins/ThroughputServiceClient.cc +++ b/HLTrigger/Timer/plugins/ThroughputServiceClient.cc @@ -3,7 +3,7 @@ #include // boost headers -#include +#include // Root headers #include @@ -65,11 +65,11 @@ void ThroughputServiceClient::fillSummaryPlots(DQMStore::IBooker &booker, DQMSto // the plots are in the main folder folders.push_back(m_dqm_path); } else { - static const boost::regex running_n_processes(".*/Running .*"); + static const std::regex running_n_processes(".*/Running .*"); booker.setCurrentFolder(m_dqm_path); std::vector subdirs = getter.getSubdirs(); for (auto const &subdir : subdirs) { - if (boost::regex_match(subdir, running_n_processes)) { + if (std::regex_match(subdir, running_n_processes)) { if (getter.get(subdir + "/throughput_sourced")) // the plots are in a per-number-of-processes subfolder folders.push_back(subdir); diff --git a/PhysicsTools/FWLite/src/TH1Store.cc b/PhysicsTools/FWLite/src/TH1Store.cc index 45c2aa119adbc..eea47e2f6ffb3 100644 --- a/PhysicsTools/FWLite/src/TH1Store.cc +++ b/PhysicsTools/FWLite/src/TH1Store.cc @@ -4,7 +4,7 @@ #include #include -#include "boost/regex.hpp" +#include #include "PhysicsTools/FWLite/interface/TH1Store.h" @@ -101,11 +101,11 @@ TDirectory *TH1Store::_createDir(const string &dirName, TFile *filePtr) const { } // if we're here, then this directory doesn't exist. Is this // directory a subdirectory? - const boost::regex subdirRE("(.+?)/([^/]+)"); - boost::smatch matches; + const std::regex subdirRE("(.+?)/([^/]+)"); + std::smatch matches; TDirectory *parentDir = nullptr; string useName = dirName; - if (boost::regex_match(dirName, matches, subdirRE)) { + if (std::regex_match(dirName, matches, subdirRE)) { parentDir = _createDir(matches[1], filePtr); useName = matches[2]; } else { diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc index 610f2d0de6542..162c2e04b3c01 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -16,7 +16,7 @@ #include #include "boost/multi_array.hpp" -#include +#include #include #include @@ -695,8 +695,8 @@ LocalError PixelCPEClusterRepair::localError(DetParam const& theDetParam, Cluste } PixelCPEClusterRepair::Rule::Rule(const std::string& str) { - static const boost::regex rule("([A-Z]+)(\\s+(\\d+))?"); - boost::cmatch match; + static const std::regex rule("([A-Z]+)(\\s+(\\d+))?"); + std::cmatch match; // match and check it works if (!regex_match(str.c_str(), match, rule)) throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n"; diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackerTrackHitFilter.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackerTrackHitFilter.cc index 1765927f927ce..ed5d466218ab2 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackerTrackHitFilter.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackerTrackHitFilter.cc @@ -45,7 +45,7 @@ #include "DataFormats/Provenance/interface/RunLumiEventNumber.h" -#include +#include #include //#include @@ -169,8 +169,8 @@ namespace reco { }; // class TrackerTrackHitFilter::Rule::Rule(const std::string &str) { - static const boost::regex rule("(keep|drop)\\s+([A-Z]+)(\\s+(\\d+))?"); - boost::cmatch match; + static const std::regex rule("(keep|drop)\\s+([A-Z]+)(\\s+(\\d+))?"); + std::cmatch match; std::string match_1; std::string match_2; std::string match_3; @@ -218,13 +218,13 @@ namespace reco { // match a set of capital case chars (preceded by an arbitrary number of leading blanks), //followed b an arbitrary number of blanks, one or more digits (not necessary, they cannot also be, // another set of blank spaces and, again another *eventual* digit - // static boost::regex rule("\\s+([A-Z]+)(\\s+(\\d+)(\\.)?(\\d+))?(\\s+(\\d+)(\\.)?(\\d+))?"); - static const boost::regex rule( + // static std::regex rule("\\s+([A-Z]+)(\\s+(\\d+)(\\.)?(\\d+))?(\\s+(\\d+)(\\.)?(\\d+))?"); + static const std::regex rule( "([A-Z]+)" "\\s*(\\d+\\.*\\d*)?" "\\s*(\\d+\\.*\\d*)?"); - boost::cmatch match; + std::cmatch match; std::string match_1; std::string match_2; std::string match_3; From c9f59b4c81265cf14f6eeb94c9a83bcbffa88dc9 Mon Sep 17 00:00:00 2001 From: camolezi Date: Mon, 22 Jun 2020 21:40:24 +0200 Subject: [PATCH 2/2] fix code format --- .../src/PixelCPEClusterRepair.cc | 150 +++++++++--------- 1 file changed, 72 insertions(+), 78 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc index 162c2e04b3c01..8a1294f3a4a89 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -362,40 +362,38 @@ void PixelCPEClusterRepair::callTempReco1D(DetParam const& theDetParam, // ****************************************************************** //--- Check exit status - if - UNLIKELY(theClusterParam.ierr != 0) { - LogDebug("PixelCPEClusterRepair::localPosition") - << "reconstruction failed with error " << theClusterParam.ierr << "\n"; - - theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; - theClusterParam.qBin_ = 0; - - // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - // To do: call PixelCPEGeneric whenever PixelTempReco1D fails - float lorentz_drift = -999.9; - if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) - lorentz_drift = 60.0f; // in microns - else - lorentz_drift = 10.0f; // in microns - // GG: trk angles needed to correct for bows/kinks - if (theClusterParam.with_track_angle) { - theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); - } else { - edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" - << "Should never be here. PixelCPEClusterRepair should always be called " - "with track angles. This is a bad error !!! "; + if UNLIKELY (theClusterParam.ierr != 0) { + LogDebug("PixelCPEClusterRepair::localPosition") + << "reconstruction failed with error " << theClusterParam.ierr << "\n"; - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); - } + theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; + theClusterParam.qBin_ = 0; + + // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + // To do: call PixelCPEGeneric whenever PixelTempReco1D fails + float lorentz_drift = -999.9; + if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) + lorentz_drift = 60.0f; // in microns + else + lorentz_drift = 10.0f; // in microns + // GG: trk angles needed to correct for bows/kinks + if (theClusterParam.with_track_angle) { + theClusterParam.templXrec_ = + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - + lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + } else { + edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called " + "with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - + lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); } - else { + } else { //--- Template Reco succeeded. The probabilities are filled. theClusterParam.hasFilledProb_ = true; @@ -483,38 +481,36 @@ void PixelCPEClusterRepair::callTempReco2D(DetParam const& theDetParam, // ****************************************************************** //--- Check exit status - if - UNLIKELY(theClusterParam.ierr2 != 0) { - LogDebug("PixelCPEClusterRepair::localPosition") - << "2D reconstruction failed with error " << theClusterParam.ierr2 << "\n"; - - theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; - theClusterParam.qBin_ = 0; - // GG: what do we do in this case? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - float lorentz_drift = -999.9; - if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) - lorentz_drift = 60.0f; // in microns // &&& replace with a constant (globally) - else - lorentz_drift = 10.0f; // in microns - // GG: trk angles needed to correct for bows/kinks - if (theClusterParam.with_track_angle) { - theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); - } else { - edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" - << "Should never be here. PixelCPEClusterRepair should always be called " - "with track angles. This is a bad error !!! "; - - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); - } + if UNLIKELY (theClusterParam.ierr2 != 0) { + LogDebug("PixelCPEClusterRepair::localPosition") + << "2D reconstruction failed with error " << theClusterParam.ierr2 << "\n"; + + theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; + theClusterParam.qBin_ = 0; + // GG: what do we do in this case? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + float lorentz_drift = -999.9; + if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) + lorentz_drift = 60.0f; // in microns // &&& replace with a constant (globally) + else + lorentz_drift = 10.0f; // in microns + // GG: trk angles needed to correct for bows/kinks + if (theClusterParam.with_track_angle) { + theClusterParam.templXrec_ = + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - + lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + } else { + edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called " + "with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - + lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); } - else { + } else { //--- Template Reco succeeded. theClusterParam.hasFilledProb_ = true; @@ -632,24 +628,22 @@ LocalError PixelCPEClusterRepair::localError(DetParam const& theDetParam, Cluste float xerr = 0.0f, yerr = 0.0f; //--- Check status of both template calls. - if - UNLIKELY((theClusterParam.ierr != 0) || (theClusterParam.ierr2 != 0)) { - // If reconstruction fails the hit position is calculated from cluster center of gravity - // corrected in x by average Lorentz drift. Assign huge errors. - // - if - UNLIKELY(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) + if UNLIKELY ((theClusterParam.ierr != 0) || (theClusterParam.ierr2 != 0)) { + // If reconstruction fails the hit position is calculated from cluster center of gravity + // corrected in x by average Lorentz drift. Assign huge errors. + // + if UNLIKELY (!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) throw cms::Exception("PixelCPEClusterRepair::localPosition :") << "A non-pixel detector type in here?"; - // Assign better errors based on the residuals for failed template cases - if (GeomDetEnumerators::isBarrel(theDetParam.thePart)) { - xerr = 55.0f * micronsToCm; // &&& get errors from elsewhere? - yerr = 36.0f * micronsToCm; - } else { - xerr = 42.0f * micronsToCm; - yerr = 39.0f * micronsToCm; - } + // Assign better errors based on the residuals for failed template cases + if (GeomDetEnumerators::isBarrel(theDetParam.thePart)) { + xerr = 55.0f * micronsToCm; // &&& get errors from elsewhere? + yerr = 36.0f * micronsToCm; + } else { + xerr = 42.0f * micronsToCm; + yerr = 39.0f * micronsToCm; } + } // Leave commented for now, until we study the interplay of failure modes // of 1D template reco and edges. For edge hits we run 2D reco by default! //