3 #include <boost/property_tree/json_parser.hpp>
4 #include <boost/property_tree/ptree.hpp>
5 #include <boost/filesystem.hpp>
13 pathToken_ = consumes<std::string, edm::InLumi>(
15 jsonToken_ = consumes<std::string, edm::InLumi>(
21 using boost::property_tree::ptree;
26 for (
auto& item : pt.get_child(key)) r.push_back(item.second.get_value<
T>());
42 if (!boost::filesystem::exists(*filePath_)) {
44 <<
" File missing: " << *filePath_
50 <<
" Opening: " << *filePath_ << std::endl;
56 for (
auto& mainTree : json.get_child(
"OccupancyPlots")) {
58 std::size_t pos = title.find(
",");
61 <<
" Invalid title" << title << std::endl;
67 auto nBins = as_vector<int>(mainTree.second,
"nbins");
68 auto xrange = as_vector<int>(mainTree.second,
"xrange");
69 auto yrange = as_vector<int>(mainTree.second,
"yrange");
71 TH2F* th =
new TH2F(name.c_str(), title.c_str(), nBins.at(0), xrange.at(0),
72 xrange.at(1), nBins.at(1), yrange.at(0), yrange.at(1));
74 for (
auto& dataArray : mainTree.second.get_child(
"data")) {
78 for (
auto& binContent : dataArray.second) {
79 *element++ = stoi(binContent.second.get_value<
std::string>());
80 if (element ==
std::end(elements))
break;
83 th->SetBinContent(elements[0], elements[1], elements[2]);
92 m = ibooker_.
book2D(name, th);
std::vector< T > as_vector(ptree const &pt, ptree::key_type const &key)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * get(const std::string &path)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< std::string > pathToken_
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
BrilClient(const edm::ParameterSet &ps)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
TH1F * getTH1F(void) const
void setCurrentFolder(const std::string &fullpath)
edm::EDGetTokenT< std::string > jsonToken_