24 #include <boost/algorithm/string/replace.hpp> 35 #include "TPaveStats.h" 36 #include "TPaletteAxis.h" 45 class DropBoxMetadataTest :
public Histogram1D<DropBoxMetadata, SINGLE_IOV> {
50 bool fill()
override {
51 auto tag = PlotBase::getTag<0>();
52 for (
auto const& iov :
tag.iovs) {
53 std::shared_ptr<DropBoxMetadata>
payload = Base::fetchPayload(std::get<1>(iov));
55 std::vector<std::string> records =
payload->getAllRecords();
56 for (
const auto&
record : records) {
59 const auto& recordParams =
parameters.getParameterMap();
60 for (
const auto& [
key,
val] : recordParams) {
61 if (
val.find(
""") != std::string::npos) {
63 edm::LogPrint(
"DropBoxMetadata_PayloadInspector") <<
key <<
" : " << replaced << std::endl;
77 while ((start_pos =
str.find(from, start_pos)) != std::string::npos) {
78 str.replace(start_pos, from.length(),
to);
79 start_pos +=
to.length();
88 class DropBoxMetadata_Display :
public PlotImage<DropBoxMetadata, SINGLE_IOV> {
92 bool fill()
override {
93 auto tag = PlotBase::getTag<0>();
94 auto iov =
tag.iovs.front();
95 std::shared_ptr<DropBoxMetadata>
payload = fetchPayload(std::get<1>(iov));
97 std::vector<std::string> records =
payload->getAllRecords();
100 for (
const auto&
record : records) {
107 theDisplay.printMetaDatas();
110 thePlot.setImageFileName(this->m_imageFileName);
111 thePlot.plotMetaDatas();
120 template <IOVMultiplicity nIOVs,
int ntags>
121 class DropBoxMetadata_CompareBase :
public PlotImage<DropBoxMetadata, nIOVs, ntags> {
123 DropBoxMetadata_CompareBase()
126 bool fill()
override {
128 auto theIOVs = PlotBase::getTag<0>().iovs;
129 auto f_tagname = PlotBase::getTag<0>().
name;
131 auto firstiov = theIOVs.front();
132 std::tuple<cond::Time_t, cond::Hash> lastiov;
135 assert(this->m_plotAnnotations.ntags < 3);
137 if (this->m_plotAnnotations.ntags == 2) {
138 auto tag2iovs = PlotBase::getTag<1>().iovs;
139 l_tagname = PlotBase::getTag<1>().
name;
140 lastiov = tag2iovs.front();
142 lastiov = theIOVs.back();
145 std::shared_ptr<DropBoxMetadata> last_payload = this->fetchPayload(std::get<1>(lastiov));
146 std::shared_ptr<DropBoxMetadata> first_payload = this->fetchPayload(std::get<1>(firstiov));
152 std::vector<std::string> f_records = first_payload->getAllRecords();
154 for (
const auto&
record : f_records) {
164 std::vector<std::string> l_records = last_payload->getAllRecords();
166 for (
const auto&
record : l_records) {
175 l_theDisplay.printDiffWithMetadata(f_theRecordMap);
179 if (tmpTagName.empty())
180 tmpTagName = f_tagname;
182 thePlot.setImageFileName(this->m_imageFileName);
183 thePlot.plotDiffWithMetadata(f_theRecordMap, f_tagname, firstIOVsince);
189 using DropBoxMetadata_Compare = DropBoxMetadata_CompareBase<MULTI_IOV, 1>;
190 using DropBoxMetadata_CompareTwoTags = DropBoxMetadata_CompareBase<SINGLE_IOV, 2>;
static std::string to_string(const XMLCh *ch)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
void replaceAll(std::string &str, const std::string &from, const std::string &to)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Log< level::Warning, true > LogPrint