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<uint8_t>(
table, icol, rowsel);
99 vfill<bool>(
table, icol, rowsel);
108 template <
typename T>
111 for (
unsigned int i = 0,
n =
data.size();
i <
n; ++
i) {
120 :
Plot(booker.bookProfile(cfg.getParameter<std::
string>(
"name"),
121 cfg.getParameter<std::
string>(
"title"),
122 cfg.getParameter<uint32_t>(
"nbins"),
123 cfg.getParameter<double>(
"min"),
124 cfg.getParameter<double>(
"max"),
131 void fill(
const FlatTable &table,
const std::vector<bool> &rowsel)
override {
138 for (
unsigned int irow = 0,
n = table.
size(); irow <
n; ++irow) {
152 if (kind ==
"count1d")
153 return std::make_unique<Count1D>(booker,
cfg);
154 if (kind ==
"hist1d")
155 return std::make_unique<Plot1D>(booker,
cfg);
156 if (kind ==
"prof1d")
157 return std::make_unique<Profile1D>(booker,
cfg);
158 throw cms::Exception(
"Configuration",
"Unsupported plot kind '" + kind +
"'");
165 std::unique_ptr<StringCutObjectSelector<FlatTable::RowView>>
cutptr;
166 std::vector<std::unique_ptr<Plot>>
plots;
171 out.resize(table.
size());
176 cutptr = std::make_unique<Selector>(replaceStringsToColumGets(
cutstr, table));
178 for (
unsigned int i = 0,
n = table.
size();
i <
n; ++
i) {
179 out[
i] = (*cutptr)(table.
row(
i));
196 group.plotPSets =
pset.getParameter<std::vector<edm::ParameterSet>>(
"plots");
197 group.selGroups.emplace_back();
203 consumesMany<FlatTable>();
211 for (
auto &sels : pair.second.selGroups) {
214 dir +=
"/" + sels.name;
216 auto &
plots = sels.plots;
218 plots.reserve(pair.second.plotPSets.size());
219 for (
const auto &
cfg : pair.second.plotPSets) {
229 std::vector<edm::Handle<FlatTable>> alltables;
231 std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
233 for (
const auto &htab : alltables) {
234 if (htab->extension())
236 maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
238 for (
const auto &htab : alltables) {
239 if (htab->extension()) {
240 if (maintables.find(htab->name()) == maintables.end())
241 throw cms::Exception(
"LogicError",
"Missing main table for " + htab->name());
242 maintables[htab->name()].second.push_back(htab.product());
249 if (maintables.find(name) == maintables.end())
253 if (!
tables.second.empty()) {
255 for (
auto *other :
tables.second) {
260 std::vector<bool> selbits;
261 for (
auto &
sel : pair.second.selGroups) {
262 sel.fillSel(*table, selbits);
265 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