From 3d8b07aa87ac93c6f0a17c6171182cbcaf137943 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:14:33 +0530 Subject: [PATCH 01/12] Update testSiPixelPayloadInspector.cpp --- CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp index 34b6ad1d50ed0..dd6b8d4226536 100644 --- a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp +++ b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "CondCore/Utilities/interface/PayloadInspector.h" #include "CondCore/SiPixelPlugins/plugins/SiPixelLorentzAngle_PayloadInspector.cc" #include "CondCore/SiPixelPlugins/plugins/SiPixelQuality_PayloadInspector.cc" @@ -15,6 +16,8 @@ #include "FWCore/PluginManager/interface/SharedLibrary.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" +namespace py = pybind11; + int main(int argc, char** argv) { Py_Initialize(); @@ -132,7 +135,7 @@ int main(int argc, char** argv) { histo16.process(connectionString, PI::mk_input(tag, end, end)); edm::LogPrint("testSiPixelPayloadInspector") << histo16.data() << std::endl; - boost::python::dict inputs; + py::dict inputs; inputs["SetLog"] = "True"; // sets to true, 1,True,Yes will work SiPixelGainCalibrationOfflineGainsValuesBarrel histo17; From 358735f734f7b08731784ab5d187b0f4458aa9f6 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:20:31 +0530 Subject: [PATCH 02/12] Update testSiStripPayloadInspector.cpp --- .../SiStripPlugins/test/testSiStripPayloadInspector.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 285202ed5293c..021dc04a0e118 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -12,6 +12,9 @@ #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" +#include + +namespace py = pybind11; int main(int argc, char** argv) { Py_Initialize(); @@ -33,7 +36,7 @@ int main(int argc, char** argv) { std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline"; cond::Time_t start = boost::lexical_cast(132440); cond::Time_t end = boost::lexical_cast(285368); - boost::python::dict inputs; + py::dict inputs; edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl; @@ -112,7 +115,9 @@ int main(int argc, char** argv) { edm::LogPrint("testSiStripPayloadInspector") << histo11.data() << std::endl; SiStripPedestalPerDetId histoPedestalForDetId; - inputs["DetIds"] += ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds + std::string tmp = inputs["DetIds"].cast(); + tmp = tmp + ",470065830,369121594,369124670,470177668"; + inputs["DetIds"] = tmp; // add a bunch of other DetIds histoPedestalForDetId.setInputParamValues(inputs); histoPedestalForDetId.process(connectionString, PI::mk_input(tag, start, start)); edm::LogPrint("testSiStripPayloadInspector") << histoPedestalForDetId.data() << std::endl; From e7f6c857b50261b51ca625402c5080fd678d16b9 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:22:47 +0530 Subject: [PATCH 03/12] Update PayloadInspector.h --- .../Utilities/interface/PayloadInspector.h | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/CondCore/Utilities/interface/PayloadInspector.h b/CondCore/Utilities/interface/PayloadInspector.h index 11d873675082d..27d5605e1de54 100644 --- a/CondCore/Utilities/interface/PayloadInspector.h +++ b/CondCore/Utilities/interface/PayloadInspector.h @@ -1,9 +1,6 @@ #ifndef CondCore_Utilities_PayloadInspector_h #define CondCore_Utilities_PayloadInspector_h -#include "CondCore/CondDB/interface/Utils.h" -#include "CondCore/CondDB/interface/Session.h" -#include "CondCore/CondDB/interface/Exception.h" #include #include @@ -13,26 +10,29 @@ #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "CondCore/CondDB/interface/Utils.h" +#include "CondCore/CondDB/interface/Session.h" +#include "CondCore/CondDB/interface/Exception.h" + +#include -#include -#include -#include +namespace py = pybind11; namespace PI { - inline boost::python::list mk_input(const std::string& tagName, cond::Time_t start, cond::Time_t end) { - boost::python::list ret; - ret.append(boost::python::make_tuple(tagName, std::to_string(start), std::to_string(end))); + inline py::list mk_input(const std::string& tagName, cond::Time_t start, cond::Time_t end) { + py::list ret; + ret.append(py::make_tuple(tagName, std::to_string(start), std::to_string(end))); return ret; } - inline boost::python::list mk_input(const std::string& tagName0, + inline py::list mk_input(const std::string& tagName0, cond::Time_t start0, cond::Time_t end0, const std::string& tagName1, cond::Time_t start1, cond::Time_t end1) { - boost::python::list ret; - ret.append(boost::python::make_tuple(tagName0, std::to_string(start0), std::to_string(end0))); - ret.append(boost::python::make_tuple(tagName1, std::to_string(start1), std::to_string(end1))); + py::list ret; + ret.append(py::make_tuple(tagName0, std::to_string(start0), std::to_string(end0))); + ret.append(py::make_tuple(tagName1, std::to_string(start1), std::to_string(end1))); return ret; } } // namespace PI @@ -228,16 +228,16 @@ namespace cond { bool isSingleIov() const; // required in the browser - boost::python::list inputParams() const; + __attribute__((visibility("default"))) py::list inputParams() const; // required in the browser - void setInputParamValues(const boost::python::dict& values); + __attribute__((visibility("default"))) void setInputParamValues(const py::dict& values); // returns the json file with the plot data std::string data() const; // triggers the processing producing the plot - bool process(const std::string& connectionString, const boost::python::list& tagsWithTimeBoundaries); + __attribute__((visibility("default"))) bool process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries); // called by the above method - to be used in C++ unit tests... bool exec_process(const std::string& connectionString, From 0b8f76a434ba440ba1fb2d6844bbfcf0c2ecec1f Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:24:50 +0530 Subject: [PATCH 04/12] Update PayloadInspectorModule.h --- .../interface/PayloadInspectorModule.h | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CondCore/Utilities/interface/PayloadInspectorModule.h b/CondCore/Utilities/interface/PayloadInspectorModule.h index 2dfa41c534671..b721ee3d181f1 100644 --- a/CondCore/Utilities/interface/PayloadInspectorModule.h +++ b/CondCore/Utilities/interface/PayloadInspectorModule.h @@ -1,18 +1,20 @@ -#include + #include + +namespace py = pybind11; #define PPCAT_NX(A, B) A##B #define PPCAT(A, B) PPCAT_NX(A, B) #define STRINGIZE_NX(A) #A #define STRINGIZE(A) STRINGIZE_NX(A) -#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) BOOST_PYTHON_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector) +#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) PYBIND11_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector,m) -#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ - boost::python::class_ >( \ - STRINGIZE(PPCAT(plot_, CLASS_NAME)), boost::python::init<>()) \ - .def("process", &cond::payloadInspector::PlotBase::process) \ - .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) \ - .def("title", &cond::payloadInspector::PlotBase::title) \ - .def("isSingleIov", &cond::payloadInspector::PlotBase::isSingleIov) \ - .def("isTwoTags", &cond::payloadInspector::PlotBase::isTwoTags) \ - .def("data", &cond::payloadInspector::PlotBase::data); +#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ + py::class_(m, STRINGIZE(PPCAT(plot_, CLASS_NAME))) \ + .def(py::init<>()) \ + .def("process", &CLASS_NAME::process) \ + .def("payloadType", &CLASS_NAME::payloadType) \ + .def("title", &CLASS_NAME::title) \ + .def("isSingleIov", &CLASS_NAME::isSingleIov) \ + .def("isTwoTags", &CLASS_NAME::isTwoTags) \ + .def("data", &CLASS_NAME::data); From 346e333c1d193bd6a88839cf59b6f1bd5b0e2311 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:26:38 +0530 Subject: [PATCH 05/12] Update Module_PayloadInspector.cc --- .../plugins/Module_PayloadInspector.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CondCore/Utilities/plugins/Module_PayloadInspector.cc b/CondCore/Utilities/plugins/Module_PayloadInspector.cc index 7b7817534709b..c913972f0b0e3 100644 --- a/CondCore/Utilities/plugins/Module_PayloadInspector.cc +++ b/CondCore/Utilities/plugins/Module_PayloadInspector.cc @@ -1,11 +1,16 @@ #include "CondCore/Utilities/interface/PayloadInspector.h" -#include -#include +#include +#include +#include +#include -BOOST_PYTHON_MODULE(pluginModule_PayloadInspector) { - boost::python::class_("ModuleVersion") - .def_readonly("label", &cond::payloadInspector::ModuleVersion::label); - boost::python::class_("PlotBase") +namespace py = pybind11; + +PYBIND11_MODULE(pluginModule_PayloadInspector,m) { + py::class_>(m,"ModuleVersion") + .def("label", []() { return cond::payloadInspector::ModuleVersion::label; } ); + + py::class_(m,"PlotBase") .def("process", &cond::payloadInspector::PlotBase::process) .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) .def("type", &cond::payloadInspector::PlotBase::type) From 7b6d17f50e0638be24925f3e0e65c643d3aa9aa5 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:28:37 +0530 Subject: [PATCH 06/12] Update getPayloadData.py --- CondCore/Utilities/scripts/getPayloadData.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CondCore/Utilities/scripts/getPayloadData.py b/CondCore/Utilities/scripts/getPayloadData.py index a585fa17a306b..9d84924994727 100755 --- a/CondCore/Utilities/scripts/getPayloadData.py +++ b/CondCore/Utilities/scripts/getPayloadData.py @@ -97,12 +97,12 @@ def deserialize_iovs(db, plugin_name, plot_name, tags, time_type, input_params): modv = getattr(plugin_base,'ModuleVersion') success = False - if modv.label == '1.0': + if modv.label() == '1.0': if len(tags)==1: success = plot.process(db_name, tags[0][0], time_type, int(tags[0][1]), int(tags[0][2]) ) elif len(tags)==2: success = plot.processTwoTags(db_name, tags[0][0], tags[1][0], int(tags[0][1]),int(tags[1][1]) ) - elif modv.label == '2.0': + elif modv.label() == '2.0': success = plot.process(db_name, tags) output('plot processed data successfully: ', success) From 2db21b937491d0ef1c0b7686c44b1598a14d77d8 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:30:22 +0530 Subject: [PATCH 07/12] Update PayloadInspector.cc --- CondCore/Utilities/src/PayloadInspector.cc | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index 15a0f80b4b6f3..d8c4b5466a708 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -5,7 +5,11 @@ #include #include -#include +#include +#include +#include + +namespace py = pybind11; namespace cond { @@ -21,8 +25,6 @@ namespace cond { return ret; } - constexpr const char* const ModuleVersion::label; - PlotBase::PlotBase() : m_plotAnnotations(), m_inputParams(), @@ -49,36 +51,40 @@ namespace cond { bool PlotBase::isTwoTags() const { return m_plotAnnotations.ntags == 2; } - boost::python::list PlotBase::inputParams() const { - boost::python::list tmp; + py::list PlotBase::inputParams() const { + py::list tmp; for (const auto& ip : m_inputParams) { tmp.append(ip); } return tmp; } - void PlotBase::setInputParamValues(const boost::python::dict& values) { - for (const auto& ip : m_inputParams) { - if (values.has_key(ip)) { - std::string val = boost::python::extract(values.get(ip)); - m_inputParamValues.insert(std::make_pair(ip, val)); - } - } + void PlotBase::setInputParamValues(const py::dict& values) { + for(auto item : values){ + std::string key = item.first.cast(); + std::string val = item.second.cast(); + m_inputParamValues.insert(std::make_pair(key, val)); + } } std::string PlotBase::data() const { return m_data; } - bool PlotBase::process(const std::string& connectionString, const boost::python::list& tagsWithTimeBoundaries) { - size_t nt = boost::python::len(tagsWithTimeBoundaries); + bool PlotBase::process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries) { + size_t nt = tagsWithTimeBoundaries.size(); bool ret = false; + py::object obj1,obj2,obj3,obj4; if (nt) { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - boost::python::tuple entry = boost::python::extract(tagsWithTimeBoundaries[i]); - std::string tagName = boost::python::extract(entry[0]); - std::string time0s = boost::python::extract(entry[1]); - std::string time1s = boost::python::extract(entry[2]); + obj1=tagsWithTimeBoundaries[i]; + py::tuple entry = obj1.cast(); + obj2=entry[0]; + obj3=entry[1]; + obj4=entry[2]; + std::string tagName = obj2.cast(); + std::string time0s = obj3.cast(); + std::string time1s = obj4.cast(); cond::Time_t time0 = boost::lexical_cast(time0s); cond::Time_t time1 = boost::lexical_cast(time1s); tags[i] = std::make_tuple(tagName, time0, time1); From cd301ecc4a0060d12f38ef7c0529e7a417c5f634 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:55:19 +0530 Subject: [PATCH 08/12] Update BuildFile.xml --- CondCore/Utilities/plugins/BuildFile.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CondCore/Utilities/plugins/BuildFile.xml b/CondCore/Utilities/plugins/BuildFile.xml index a102433193fa1..8f045f1006aac 100644 --- a/CondCore/Utilities/plugins/BuildFile.xml +++ b/CondCore/Utilities/plugins/BuildFile.xml @@ -12,7 +12,8 @@ - + + From 49e40a55eb1713e632cb4b8b19c820700e51d804 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Thu, 29 Jul 2021 14:05:54 +0200 Subject: [PATCH 09/12] applied suggested code checks --- .../Utilities/interface/PayloadInspector.h | 13 ++++++----- .../interface/PayloadInspectorModule.h | 23 ++++++++++--------- .../plugins/Module_PayloadInspector.cc | 11 +++++---- CondCore/Utilities/src/PayloadInspector.cc | 22 +++++++++--------- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/CondCore/Utilities/interface/PayloadInspector.h b/CondCore/Utilities/interface/PayloadInspector.h index 27d5605e1de54..9e625afb74d19 100644 --- a/CondCore/Utilities/interface/PayloadInspector.h +++ b/CondCore/Utilities/interface/PayloadInspector.h @@ -25,11 +25,11 @@ namespace PI { return ret; } inline py::list mk_input(const std::string& tagName0, - cond::Time_t start0, - cond::Time_t end0, - const std::string& tagName1, - cond::Time_t start1, - cond::Time_t end1) { + cond::Time_t start0, + cond::Time_t end0, + const std::string& tagName1, + cond::Time_t start1, + cond::Time_t end1) { py::list ret; ret.append(py::make_tuple(tagName0, std::to_string(start0), std::to_string(end0))); ret.append(py::make_tuple(tagName1, std::to_string(start1), std::to_string(end1))); @@ -237,7 +237,8 @@ namespace cond { std::string data() const; // triggers the processing producing the plot - __attribute__((visibility("default"))) bool process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries); + __attribute__((visibility("default"))) bool process(const std::string& connectionString, + const py::list& tagsWithTimeBoundaries); // called by the above method - to be used in C++ unit tests... bool exec_process(const std::string& connectionString, diff --git a/CondCore/Utilities/interface/PayloadInspectorModule.h b/CondCore/Utilities/interface/PayloadInspectorModule.h index b721ee3d181f1..f3c600b3f39d1 100644 --- a/CondCore/Utilities/interface/PayloadInspectorModule.h +++ b/CondCore/Utilities/interface/PayloadInspectorModule.h @@ -1,4 +1,4 @@ - #include +#include namespace py = pybind11; @@ -7,14 +7,15 @@ namespace py = pybind11; #define STRINGIZE_NX(A) #A #define STRINGIZE(A) STRINGIZE_NX(A) -#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) PYBIND11_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector,m) +#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) PYBIND11_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector, m) -#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ - py::class_(m, STRINGIZE(PPCAT(plot_, CLASS_NAME))) \ - .def(py::init<>()) \ - .def("process", &CLASS_NAME::process) \ - .def("payloadType", &CLASS_NAME::payloadType) \ - .def("title", &CLASS_NAME::title) \ - .def("isSingleIov", &CLASS_NAME::isSingleIov) \ - .def("isTwoTags", &CLASS_NAME::isTwoTags) \ - .def("data", &CLASS_NAME::data); +#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ + py::class_(m, \ + STRINGIZE(PPCAT(plot_, CLASS_NAME))) \ + .def(py::init<>()) \ + .def("process", &CLASS_NAME::process) \ + .def("payloadType", &CLASS_NAME::payloadType) \ + .def("title", &CLASS_NAME::title) \ + .def("isSingleIov", &CLASS_NAME::isSingleIov) \ + .def("isTwoTags", &CLASS_NAME::isTwoTags) \ + .def("data", &CLASS_NAME::data); diff --git a/CondCore/Utilities/plugins/Module_PayloadInspector.cc b/CondCore/Utilities/plugins/Module_PayloadInspector.cc index c913972f0b0e3..918768959b9db 100644 --- a/CondCore/Utilities/plugins/Module_PayloadInspector.cc +++ b/CondCore/Utilities/plugins/Module_PayloadInspector.cc @@ -6,11 +6,12 @@ namespace py = pybind11; -PYBIND11_MODULE(pluginModule_PayloadInspector,m) { - py::class_>(m,"ModuleVersion") - .def("label", []() { return cond::payloadInspector::ModuleVersion::label; } ); - - py::class_(m,"PlotBase") +PYBIND11_MODULE(pluginModule_PayloadInspector, m) { + py::class_>( + m, "ModuleVersion") + .def("label", []() { return cond::payloadInspector::ModuleVersion::label; }); + + py::class_(m, "PlotBase") .def("process", &cond::payloadInspector::PlotBase::process) .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) .def("type", &cond::payloadInspector::PlotBase::type) diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index d8c4b5466a708..297b6c52c96c2 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -59,12 +59,12 @@ namespace cond { return tmp; } - void PlotBase::setInputParamValues(const py::dict& values) { - for(auto item : values){ - std::string key = item.first.cast(); - std::string val = item.second.cast(); - m_inputParamValues.insert(std::make_pair(key, val)); - } + void PlotBase::setInputParamValues(const py::dict& values) { + for (auto item : values) { + std::string key = item.first.cast(); + std::string val = item.second.cast(); + m_inputParamValues.insert(std::make_pair(key, val)); + } } std::string PlotBase::data() const { return m_data; } @@ -72,16 +72,16 @@ namespace cond { bool PlotBase::process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries) { size_t nt = tagsWithTimeBoundaries.size(); bool ret = false; - py::object obj1,obj2,obj3,obj4; + py::object obj1, obj2, obj3, obj4; if (nt) { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - obj1=tagsWithTimeBoundaries[i]; + obj1 = tagsWithTimeBoundaries[i]; py::tuple entry = obj1.cast(); - obj2=entry[0]; - obj3=entry[1]; - obj4=entry[2]; + obj2 = entry[0]; + obj3 = entry[1]; + obj4 = entry[2]; std::string tagName = obj2.cast(); std::string time0s = obj3.cast(); std::string time1s = obj4.cast(); From ac41e3add02685e3f3f744dbb5bc996461d71170 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:39:22 +0530 Subject: [PATCH 10/12] Update testSiStripPayloadInspector.cpp --- CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 021dc04a0e118..de92725c5a796 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -115,9 +115,7 @@ int main(int argc, char** argv) { edm::LogPrint("testSiStripPayloadInspector") << histo11.data() << std::endl; SiStripPedestalPerDetId histoPedestalForDetId; - std::string tmp = inputs["DetIds"].cast(); - tmp = tmp + ",470065830,369121594,369124670,470177668"; - inputs["DetIds"] = tmp; // add a bunch of other DetIds + inputs["DetIds"] = inputs["DetIds"].cast() + ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds histoPedestalForDetId.setInputParamValues(inputs); histoPedestalForDetId.process(connectionString, PI::mk_input(tag, start, start)); edm::LogPrint("testSiStripPayloadInspector") << histoPedestalForDetId.data() << std::endl; From e18153fb31b11c5fc3a2ad6cce21520bb2a3fd53 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:44:14 +0530 Subject: [PATCH 11/12] Update PayloadInspector.cc --- CondCore/Utilities/src/PayloadInspector.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index 297b6c52c96c2..8f77922a5685b 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -63,7 +63,9 @@ namespace cond { for (auto item : values) { std::string key = item.first.cast(); std::string val = item.second.cast(); - m_inputParamValues.insert(std::make_pair(key, val)); + if (m_inputParams.find(key) != m_inputParams.end()) { + m_inputParamValues.insert(std::make_pair(key, val)); + } } } @@ -72,19 +74,14 @@ namespace cond { bool PlotBase::process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries) { size_t nt = tagsWithTimeBoundaries.size(); bool ret = false; - py::object obj1, obj2, obj3, obj4; if (nt) { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - obj1 = tagsWithTimeBoundaries[i]; - py::tuple entry = obj1.cast(); - obj2 = entry[0]; - obj3 = entry[1]; - obj4 = entry[2]; - std::string tagName = obj2.cast(); - std::string time0s = obj3.cast(); - std::string time1s = obj4.cast(); + py::tuple entry = tagsWithTimeBoundaries[i].cast(); + std::string tagName = entry[0].cast(); + std::string time0s = entry[1].cast(); + std::string time1s = entry[2].cast(); cond::Time_t time0 = boost::lexical_cast(time0s); cond::Time_t time1 = boost::lexical_cast(time1s); tags[i] = std::make_tuple(tagName, time0, time1); From 9223cae5d81b3999ed625edc4fa9edce30b6c2bc Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Fri, 30 Jul 2021 12:42:36 +0200 Subject: [PATCH 12/12] Applied code check --- CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index de92725c5a796..1639a0998b292 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -115,7 +115,8 @@ int main(int argc, char** argv) { edm::LogPrint("testSiStripPayloadInspector") << histo11.data() << std::endl; SiStripPedestalPerDetId histoPedestalForDetId; - inputs["DetIds"] = inputs["DetIds"].cast() + ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds + inputs["DetIds"] = + inputs["DetIds"].cast() + ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds histoPedestalForDetId.setInputParamValues(inputs); histoPedestalForDetId.process(connectionString, PI::mk_input(tag, start, start)); edm::LogPrint("testSiStripPayloadInspector") << histoPedestalForDetId.data() << std::endl;