1 #ifndef DropBoxMetaDataPayloadInspectorHelper_H
2 #define DropBoxMetaDataPayloadInspectorHelper_H
9 #include <fmt/printf.h>
11 #include <boost/tokenizer.hpp>
12 #include <boost/range/adaptor/indexed.hpp>
16 namespace DBoxMetadataHelper {
22 for (
const auto& [
key,
val] : theParameters) {
23 if (
key.find(
"prep") != std::string::npos) {
25 }
else if (
key.find(
"prod") != std::string::npos) {
27 }
else if (
key.find(
"mult") != std::string::npos) {
47 using recordMap = std::map<std::string, RecordMetaDataInfo>;
50 std::vector<std::string> records;
53 std::inserter(records, records.end()),
54 [](std::pair<std::string, DBoxMetadataHelper::RecordMetaDataInfo> recordSetEntry) ->
std::string {
55 return recordSetEntry.first;
60 inline std::vector<std::string>
set_difference(std::vector<std::string>
const& v1,
61 std::vector<std::string>
const& v2) {
62 std::vector<std::string>
diff;
68 std::vector<std::string>
const& v2) {
69 std::vector<std::string> common;
81 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"key: " <<
key <<
"\n\n" << std::endl;
85 if (
val.hasMultiMetaData()) {
99 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"\n" << std::endl;
104 <<
"Target has: " <<
m_Map.size() <<
" records, reference has: " << theRefMap.size() <<
" records"
114 for (
const auto&
key : common) {
115 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"key: " <<
key <<
"\n" << std::endl;
117 const auto& refval = theRefMap.at(
key);
119 if ((
val.getPrepMetaData()).
compare(refval.getPrepMetaData()) != 0) {
120 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"found difference in prep metadata!" << std::endl;
123 <<
" in reference: " <<
cleanJson(refval.getPrepMetaData()) << std::endl;
125 if ((
val.getProdMetaData()).
compare(refval.getProdMetaData()) != 0) {
126 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"found difference in prod metadata!" << std::endl;
129 <<
" in reference: " <<
cleanJson(refval.getProdMetaData()) << std::endl;
131 if ((
val.getMultiMetaData()).
compare(refval.getMultiMetaData()) != 0) {
132 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"found difference in multi metadata!" << std::endl;
135 <<
" in reference: " <<
cleanJson(refval.getMultiMetaData()) << std::endl;
137 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"\n" << std::endl;
143 if (ref_records.size() > tar_records.size()) {
144 for (
const auto& ref : ref_records) {
145 if (
std::find(tar_records.begin(), tar_records.end(), ref) == tar_records.end()) {
146 const auto& refval = theRefMap.at(ref);
147 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"key: " << ref <<
" not present in target! \n" << std::endl;
153 else if (tar_records.size() > ref_records.size()) {
154 for (
const auto& tar : tar_records) {
155 if (
std::find(ref_records.begin(), ref_records.end(), tar) == ref_records.end()) {
156 const auto& tarval =
m_Map.at(tar);
157 edm::LogPrint(
"DropBoxMetadataPIHelper") <<
"key: " << tar <<
" not present in reference! \n"
170 size_t start_pos = 0;
171 while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
172 str.replace(start_pos, from.length(), to);
173 start_pos += to.length();
bool compare(const P &i, const P &j)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
tuple key
prepare the HTCondor submission files and eventually submit them
Log< level::Warning, true > LogPrint