22 #include <type_traits> 26 auto find = iValue.find_first_not_of(
"0123456789");
27 return find != std::string::npos;
29 bool notRowMethod(
std::string const &iValue) {
return iValue !=
"row" and iValue !=
"table"; }
31 bool notAFunction(
std::string const &iSuffix) {
return (iSuffix.empty()
or iSuffix[0] !=
'('); }
33 std::regex
token(
"\\w+");
34 std::sregex_iterator tbegin(
expr.begin(),
expr.end(),
token), tend;
37 std::stringstream
out;
38 std::sregex_iterator
last;
39 for (std::sregex_iterator
i = tbegin;
i != tend;
last =
i, ++
i) {
40 const std::smatch &
match = *
i;
42 if (notAFunction(
i->suffix().str()) and notANumber(
match.str()) and notRowMethod(
match.str())) {
43 out <<
"getAnyValue(\"" <<
match.str() <<
"\")";
82 cfg.getParameter<uint32_t>(
"nbins"),
83 cfg.getParameter<double>(
"min"),
84 cfg.getParameter<double>(
"max"))) {}
87 plot_->
Fill(std::accumulate(rowsel.begin(), rowsel.end(), 0u));
96 cfg.getParameter<uint32_t>(
"nbins"),
97 cfg.getParameter<double>(
"min"),
98 cfg.getParameter<double>(
"max"))),
106 switch (
table.columnType(icol)) {
108 vfill<uint8_t>(
table, icol, rowsel);
111 vfill<int16_t>(
table, icol, rowsel);
114 vfill<uint16_t>(
table, icol, rowsel);
117 vfill<int32_t>(
table, icol, rowsel);
120 vfill<uint32_t>(
table, icol, rowsel);
123 vfill<bool>(
table, icol, rowsel);
126 vfill<float>(
table, icol, rowsel);
129 vfill<double>(
table, icol, rowsel);
139 template <
typename T>
142 for (
unsigned int i = 0,
n =
data.size();
i <
n; ++
i) {
147 for (
unsigned int b = 0; b < std::numeric_limits<T>::digits;
b++) {
167 cfg.getParameter<uint32_t>(
"nbins"),
168 cfg.getParameter<double>(
"min"),
169 cfg.getParameter<double>(
"max"),
183 for (
unsigned int irow = 0,
n =
table.size(); irow <
n; ++irow) {
197 if (
kind ==
"count1d")
198 return std::make_unique<Count1D>(booker,
cfg);
199 if (
kind ==
"hist1d")
200 return std::make_unique<Plot1D>(booker,
cfg);
201 if (
kind ==
"prof1d")
202 return std::make_unique<Profile1D>(booker,
cfg);
210 std::unique_ptr<StringCutObjectSelector<FlatTable::RowView>>
cutptr;
211 std::vector<std::unique_ptr<Plot>>
plots;
215 cutptr = std::make_unique<Selector>(replaceStringsToColumGets(
cutstr));
224 for (
unsigned int i = 0,
n =
table.size();
i <
n; ++
i) {
243 group.plotPSets =
pset.getParameter<std::vector<edm::ParameterSet>>(
"plots");
244 group.selGroups.emplace_back();
257 sels.setComment(
"a paramerter set to define the selections to be made from the table row");
267 "column",
true,
edm::Comment(
"name of the raw to fill the content of the plot"));
269 "xcolumn",
true,
edm::Comment(
"name of the raw to fill the x content of the plot"));
271 "ycolumn",
true,
edm::Comment(
"name of the raw to fill the y content of the plot"));
274 plot.setComment(
"a parameter set that defines a DQM histogram");
284 "a parameter set to define all the plots to be made from a table row selected from the name of the PSet");
289 vplots.setComment(
"a parameter set to define all the set of plots to be made from the tables");
301 for (
auto &
sels : pair.second.selGroups) {
308 plots.reserve(pair.second.plotPSets.size());
309 for (
const auto &
cfg : pair.second.plotPSets) {
319 std::vector<edm::Handle<FlatTable>> alltables;
321 std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
323 for (
const auto &htab : alltables) {
324 if (htab->extension())
326 maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
328 for (
const auto &htab : alltables) {
329 if (htab->extension()) {
330 if (maintables.find(htab->name()) == maintables.end())
331 throw cms::Exception(
"LogicError",
"Missing main table for " + htab->name());
332 maintables[htab->name()].second.push_back(htab.product());
339 if (maintables.find(
name) == maintables.end())
341 auto &tables = maintables[
name];
343 if (!tables.second.empty()) {
344 merged = *tables.first;
345 for (
auto *
other : tables.second) {
350 std::vector<bool> selbits;
351 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)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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
static constexpr float b1