16 std::regex
token(
"\\w+");
17 std::sregex_iterator tbegin(expr.begin(), expr.end(),
token), tend;
20 std::stringstream
out;
21 std::sregex_iterator
last;
22 for (std::sregex_iterator
i = tbegin;
i != tend; last =
i, ++
i) {
24 out << match.prefix().str();
26 out <<
"getAnyValue(\"" << match.str() <<
"\")";
31 out << last->suffix().str();
53 virtual void fill(
const FlatTable &table,
const std::vector<bool> &rowsel) = 0;
64 cfg.getParameter<uint32_t>(
"nbins"),
65 cfg.getParameter<double>(
"min"),
66 cfg.getParameter<double>(
"max"))) {}
68 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
69 plot_->
Fill(std::accumulate(rowsel.begin(), rowsel.end(), 0u));
78 cfg.getParameter<uint32_t>(
"nbins"),
79 cfg.getParameter<double>(
"min"),
80 cfg.getParameter<double>(
"max"))),
81 col_(cfg.getParameter<
std::
string>(
"column")) {}
83 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
89 vfill<float>(
table, icol, rowsel);
92 vfill<int>(
table, icol, rowsel);
95 vfill<uint8_t>(
table, icol, rowsel);
98 vfill<uint8_t>(
table, icol, rowsel);
105 template <
typename T>
106 void vfill(
const FlatTable &table,
int icol,
const std::vector<bool> &rowsel) {
108 for (
unsigned int i = 0,
n =
data.size();
i <
n; ++
i) {
117 :
Plot(booker.bookProfile(cfg.getParameter<
std::
string>(
"name"),
119 cfg.getParameter<uint32_t>(
"nbins"),
120 cfg.getParameter<double>(
"min"),
121 cfg.getParameter<double>(
"max"),
125 ycol_(cfg.getParameter<
std::
string>(
"ycolumn")),
126 xcol_(cfg.getParameter<
std::
string>(
"xcolumn")) {}
128 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
135 for (
unsigned int irow = 0,
n = table.
size(); irow <
n; ++irow) {
149 if (kind ==
"count1d")
150 return std::make_unique<Count1D>(booker,
cfg);
151 if (kind ==
"hist1d")
152 return std::make_unique<Plot1D>(booker,
cfg);
153 if (kind ==
"prof1d")
154 return std::make_unique<Profile1D>(booker,
cfg);
155 throw cms::Exception(
"Configuration",
"Unsupported plot kind '" + kind +
"'");
162 std::unique_ptr<StringCutObjectSelector<FlatTable::RowView>>
cutptr;
163 std::vector<std::unique_ptr<Plot>>
plots;
166 bool nullCut()
const {
return cutstr.empty(); }
167 void fillSel(
const FlatTable &table, std::vector<bool> &out) {
168 out.resize(table.
size());
173 cutptr.reset(
new Selector(replaceStringsToColumGets(cutstr, table)));
175 for (
unsigned int i = 0,
n = table.
size();
i <
n; ++
i) {
176 out[
i] = (*cutptr)(table.
row(
i));
193 group.plotPSets =
pset.getParameter<std::vector<edm::ParameterSet>>(
"plots");
194 group.selGroups.emplace_back();
200 consumesMany<FlatTable>();
208 for (
auto &
sels : pair.second.selGroups) {
211 dir +=
"/" +
sels.name;
215 plots.reserve(pair.second.plotPSets.size());
216 for (
const auto &
cfg : pair.second.plotPSets) {
226 std::vector<edm::Handle<FlatTable>> alltables;
228 std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
230 for (
const auto &htab : alltables) {
231 if (htab->extension())
233 maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
235 for (
const auto &htab : alltables) {
236 if (htab->extension()) {
237 if (maintables.find(htab->name()) == maintables.end())
238 throw cms::Exception(
"LogicError",
"Missing main table for " + htab->name());
239 maintables[htab->name()].second.push_back(htab.product());
246 if (maintables.find(name) == maintables.end())
250 if (!
tables.second.empty()) {
257 std::vector<bool> selbits;
258 for (
auto &
sel : pair.second.selGroups) {
259 sel.fillSel(*table, selbits);
262 plot->fill(*table, selbits);
boost::sub_range< const std::vector< T > > columnData(unsigned int column) const
get a column by index (const)
void addExtension(const FlatTable &extension)
T getParameter(std::string const &) const
RowView row(unsigned int row) const
std::vector< edm::ParameterSet > plotPSets
int columnIndex(const std::string &name) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
virtual void fill(const FlatTable &table, const std::vector< bool > &rowsel)=0
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void setCurrentFolder(std::string const &fullpath)
std::vector< SelGroupConfig > selGroups
ColumnType columnType(unsigned int col) const
std::unique_ptr< StringCutObjectSelector< FlatTable::RowView > > cutptr
void analyze(const edm::Event &, const edm::EventSetup &) override
const std::string & getName() const
get name of ME
nanoaod::FlatTable FlatTable
void getManyByType(std::vector< Handle< PROD >> &results) const
static std::unique_ptr< Plot > makePlot(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
Plot1D(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
NanoAODDQM(const edm::ParameterSet &)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Profile1D(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
#define DEFINE_FWK_MODULE(type)
std::map< std::string, GroupConfig > groups_
void vfill(const FlatTable &table, int icol, const std::vector< bool > &rowsel)
void fill(const FlatTable &table, const std::vector< bool > &rowsel) override
Count1D(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
void fill(const FlatTable &table, const std::vector< bool > &rowsel) override
std::vector< std::unique_ptr< Plot > > plots
SelGroupConfig(const std::string &nam, const std::string &cut)
unsigned int size() const
char data[epos_bytes_allocation]
StringCutObjectSelector< FlatTable::RowView > Selector
void fillSel(const FlatTable &table, std::vector< bool > &out)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void fill(const FlatTable &table, const std::vector< bool > &rowsel) override
double getAnyValue(unsigned int row, unsigned int column) const
const std::string & name() const