22 #include <type_traits> 26 std::regex
token(
"\\w+");
27 std::sregex_iterator tbegin(expr.begin(), expr.end(),
token), tend;
30 std::stringstream
out;
31 std::sregex_iterator
last;
32 for (std::sregex_iterator
i = tbegin;
i != tend;
last =
i, ++
i) {
33 const std::smatch &
match = *
i;
36 out <<
"getAnyValue(\"" <<
match.str() <<
"\")";
75 cfg.getParameter<uint32_t>(
"nbins"),
76 cfg.getParameter<double>(
"min"),
77 cfg.getParameter<double>(
"max"))) {}
80 plot_->
Fill(std::accumulate(rowsel.begin(), rowsel.end(), 0u));
89 cfg.getParameter<uint32_t>(
"nbins"),
90 cfg.getParameter<double>(
"min"),
91 cfg.getParameter<double>(
"max"))),
99 switch (
table.columnType(icol)) {
101 vfill<int8_t>(
table, icol, rowsel);
104 vfill<uint8_t>(
table, icol, rowsel);
107 vfill<int16_t>(
table, icol, rowsel);
110 vfill<uint16_t>(
table, icol, rowsel);
113 vfill<int32_t>(
table, icol, rowsel);
116 vfill<uint32_t>(
table, icol, rowsel);
119 vfill<bool>(
table, icol, rowsel);
122 vfill<float>(
table, icol, rowsel);
125 vfill<double>(
table, icol, rowsel);
135 template <
typename T>
138 for (
unsigned int i = 0,
n =
data.size();
i <
n; ++
i) {
143 for (
unsigned int b = 0; b < std::numeric_limits<T>::digits;
b++) {
163 cfg.getParameter<uint32_t>(
"nbins"),
164 cfg.getParameter<double>(
"min"),
165 cfg.getParameter<double>(
"max"),
179 for (
unsigned int irow = 0,
n =
table.size(); irow <
n; ++irow) {
193 if (
kind ==
"count1d")
194 return std::make_unique<Count1D>(booker,
cfg);
195 if (
kind ==
"hist1d")
196 return std::make_unique<Plot1D>(booker,
cfg);
197 if (
kind ==
"prof1d")
198 return std::make_unique<Profile1D>(booker,
cfg);
206 std::unique_ptr<StringCutObjectSelector<FlatTable::RowView>>
cutptr;
207 std::vector<std::unique_ptr<Plot>>
plots;
219 for (
unsigned int i = 0,
n =
table.size();
i <
n; ++
i) {
238 group.plotPSets =
pset.getParameter<std::vector<edm::ParameterSet>>(
"plots");
239 group.selGroups.emplace_back();
252 sels.setComment(
"a paramerter set to define the selections to be made from the table row");
262 "column",
true,
edm::Comment(
"name of the raw to fill the content of the plot"));
264 "xcolumn",
true,
edm::Comment(
"name of the raw to fill the x content of the plot"));
266 "ycolumn",
true,
edm::Comment(
"name of the raw to fill the y content of the plot"));
269 plot.setComment(
"a parameter set that defines a DQM histogram");
279 "a parameter set to define all the plots to be made from a table row selected from the name of the PSet");
284 vplots.setComment(
"a parameter set to define all the set of plots to be made from the tables");
296 for (
auto &
sels : pair.second.selGroups) {
303 plots.reserve(pair.second.plotPSets.size());
304 for (
const auto &
cfg : pair.second.plotPSets) {
314 std::vector<edm::Handle<FlatTable>> alltables;
316 std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
318 for (
const auto &htab : alltables) {
319 if (htab->extension())
321 maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
323 for (
const auto &htab : alltables) {
324 if (htab->extension()) {
325 if (maintables.find(htab->name()) == maintables.end())
326 throw cms::Exception(
"LogicError",
"Missing main table for " + htab->name());
327 maintables[htab->name()].second.push_back(htab.product());
334 if (maintables.find(
name) == maintables.end())
338 if (!
tables.second.empty()) {
345 std::vector<bool> selbits;
346 for (
auto &
sel : pair.second.selGroups) {
void addExtension(const FlatTable &extension)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
std::vector< edm::ParameterSet > plotPSets
const std::string & name() const
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
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
std::vector< SelGroupConfig > selGroups
std::unique_ptr< StringCutObjectSelector< FlatTable::RowView > > cutptr
void analyze(const edm::Event &, const edm::EventSetup &) override
nanoaod::FlatTable FlatTable
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 &)
Profile1D(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
void setComment(std::string const &value)
std::map< std::string, GroupConfig > groups_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void vfill(const FlatTable &table, int icol, const std::vector< bool > &rowsel)
#define DEFINE_FWK_MODULE(type)
void fill(const FlatTable &table, const std::vector< bool > &rowsel) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::GetterOfProducts< FlatTable > getterOfProducts_
const std::string & getName() const
get name of ME
SelGroupConfig(const std::string &nam, const std::string &cut)
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