18 std::regex
token(
"\\w+");
19 std::sregex_iterator tbegin(expr.begin(), expr.end(),
token), tend;
22 std::stringstream
out;
23 std::sregex_iterator
last;
24 for (std::sregex_iterator
i = tbegin;
i != tend; last =
i, ++
i) {
26 out << match.prefix().str();
28 out <<
"getAnyValue(\"" << match.str() <<
"\")";
33 out << last->suffix().str();
54 virtual void fill(
const FlatTable &table,
const std::vector<bool> &rowsel) = 0;
63 :
Plot(booker.book1D(cfg.getParameter<std::
string>(
"name"),
64 cfg.getParameter<std::
string>(
"title"),
65 cfg.getParameter<uint32_t>(
"nbins"),
66 cfg.getParameter<double>(
"min"),
67 cfg.getParameter<double>(
"max"))) {}
69 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
70 plot_->
Fill(std::accumulate(rowsel.begin(), rowsel.end(), 0u));
77 :
Plot(booker.book1D(cfg.getParameter<std::
string>(
"name"),
78 cfg.getParameter<std::
string>(
"title"),
79 cfg.getParameter<uint32_t>(
"nbins"),
80 cfg.getParameter<double>(
"min"),
81 cfg.getParameter<double>(
"max"))),
82 col_(cfg.getParameter<std::
string>(
"column")) {}
84 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
90 vfill<float>(
table, icol, rowsel);
93 vfill<int>(
table, icol, rowsel);
96 vfill<int8_t>(
table, icol, rowsel);
99 vfill<uint8_t>(
table, icol, rowsel);
102 vfill<bool>(
table, icol, rowsel);
111 template <
typename T>
114 for (
unsigned int i = 0,
n =
data.size();
i <
n; ++
i) {
123 :
Plot(booker.bookProfile(cfg.getParameter<std::
string>(
"name"),
124 cfg.getParameter<std::
string>(
"title"),
125 cfg.getParameter<uint32_t>(
"nbins"),
126 cfg.getParameter<double>(
"min"),
127 cfg.getParameter<double>(
"max"),
134 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
141 for (
unsigned int irow = 0,
n = table.
size(); irow <
n; ++irow) {
155 if (kind ==
"count1d")
156 return std::make_unique<Count1D>(booker,
cfg);
157 if (kind ==
"hist1d")
158 return std::make_unique<Plot1D>(booker,
cfg);
159 if (kind ==
"prof1d")
160 return std::make_unique<Profile1D>(booker,
cfg);
161 throw cms::Exception(
"Configuration",
"Unsupported plot kind '" + kind +
"'");
168 std::unique_ptr<StringCutObjectSelector<FlatTable::RowView>>
cutptr;
169 std::vector<std::unique_ptr<Plot>>
plots;
174 out.resize(table.
size());
179 cutptr = std::make_unique<Selector>(replaceStringsToColumGets(
cutstr, table));
181 for (
unsigned int i = 0,
n = table.
size();
i <
n; ++
i) {
182 out[
i] = (*cutptr)(table.
row(
i));
199 group.plotPSets =
pset.getParameter<std::vector<edm::ParameterSet>>(
"plots");
200 group.selGroups.emplace_back();
206 consumesMany<FlatTable>();
214 for (
auto &sels : pair.second.selGroups) {
217 dir +=
"/" + sels.name;
219 auto &
plots = sels.plots;
221 plots.reserve(pair.second.plotPSets.size());
222 for (
const auto &
cfg : pair.second.plotPSets) {
232 std::vector<edm::Handle<FlatTable>> alltables;
234 std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
236 for (
const auto &htab : alltables) {
237 if (htab->extension())
239 maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
241 for (
const auto &htab : alltables) {
242 if (htab->extension()) {
243 if (maintables.find(htab->name()) == maintables.end())
244 throw cms::Exception(
"LogicError",
"Missing main table for " + htab->name());
245 maintables[htab->name()].second.push_back(htab.product());
252 if (maintables.find(name) == maintables.end())
256 if (!
tables.second.empty()) {
258 for (
auto *other :
tables.second) {
263 std::vector<bool> selbits;
264 for (
auto &
sel : pair.second.selGroups) {
265 sel.fillSel(*table, selbits);
268 plot->fill(*table, selbits);
void addExtension(const FlatTable &extension)
RowView row(unsigned int row) const
std::vector< edm::ParameterSet > plotPSets
int columnIndex(const std::string &name) const
virtual void fill(const FlatTable &table, const std::vector< bool > &rowsel)=0
virtual void setCurrentFolder(std::string const &fullpath)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
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 &)
auto columnData(unsigned int column) const
get a column by index (const)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Profile1D(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
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
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
std::vector< std::unique_ptr< Plot > > plots
T getParameter(std::string const &) const
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