CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
NanoAODDQM::Plot1D Class Reference
Inheritance diagram for NanoAODDQM::Plot1D:
NanoAODDQM::Plot

Public Member Functions

void fill (const FlatTable &table, const std::vector< bool > &rowsel) override
 
 Plot1D (DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
 
 ~Plot1D () override
 
- Public Member Functions inherited from NanoAODDQM::Plot
const std::string & name () const
 
 Plot (MonitorElement *me)
 
virtual ~Plot ()
 

Protected Member Functions

template<typename T >
void vfill (const FlatTable &table, int icol, const std::vector< bool > &rowsel)
 

Protected Attributes

bool bitset_
 
std::string col_
 
- Protected Attributes inherited from NanoAODDQM::Plot
MonitorElementplot_
 

Detailed Description

Definition at line 84 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

◆ Plot1D()

NanoAODDQM::Plot1D::Plot1D ( DQMStore::IBooker booker,
const edm::ParameterSet cfg 
)
inline

Definition at line 86 of file NanoAODDQM.cc.

87  : Plot(booker.book1D(cfg.getParameter<std::string>("name"),
88  cfg.getParameter<std::string>("title"),
89  cfg.getParameter<uint32_t>("nbins"),
90  cfg.getParameter<double>("min"),
91  cfg.getParameter<double>("max"))),
92  col_(cfg.getParameter<std::string>("column")),
93  bitset_(cfg.getParameter<bool>("bitset")) {}
std::string col_
Definition: NanoAODDQM.cc:133
Plot(MonitorElement *me)
Definition: NanoAODDQM.cc:62
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ ~Plot1D()

NanoAODDQM::Plot1D::~Plot1D ( )
inlineoverride

Definition at line 94 of file NanoAODDQM.cc.

94 {}

Member Function Documentation

◆ fill()

void NanoAODDQM::Plot1D::fill ( const FlatTable table,
const std::vector< bool > &  rowsel 
)
inlineoverridevirtual

Implements NanoAODDQM::Plot.

Definition at line 95 of file NanoAODDQM.cc.

References nanoaod::FlatTable::Bool, col_, nanoaod::FlatTable::Double, Exception, nanoaod::FlatTable::Float, nanoaod::FlatTable::Int16, nanoaod::FlatTable::Int32, nanoaod::FlatTable::Int8, TableParser::table, nanoaod::FlatTable::UInt16, nanoaod::FlatTable::UInt32, and nanoaod::FlatTable::UInt8.

95  {
96  int icol = table.columnIndex(col_);
97  if (icol == -1)
98  return; // columns may be missing (e.g. mc-only)
99  switch (table.columnType(icol)) {
101  vfill<int8_t>(table, icol, rowsel);
102  break;
104  vfill<uint8_t>(table, icol, rowsel);
105  break;
107  vfill<int16_t>(table, icol, rowsel);
108  break;
110  vfill<uint16_t>(table, icol, rowsel);
111  break;
113  vfill<int32_t>(table, icol, rowsel);
114  break;
116  vfill<uint32_t>(table, icol, rowsel);
117  break;
119  vfill<bool>(table, icol, rowsel);
120  break;
122  vfill<float>(table, icol, rowsel);
123  break;
125  vfill<double>(table, icol, rowsel);
126  break;
127  default:
128  throw cms::Exception("LogicError", "Unsupported type");
129  }
130  }
std::string col_
Definition: NanoAODDQM.cc:133

◆ vfill()

template<typename T >
void NanoAODDQM::Plot1D::vfill ( const FlatTable table,
int  icol,
const std::vector< bool > &  rowsel 
)
inlineprotected

Definition at line 136 of file NanoAODDQM.cc.

References b, b1, bitset_, data, dqm::impl::MonitorElement::Fill(), mps_fire::i, dqmiodumpmetadata::n, NanoAODDQM::Plot::plot_, TableParser::table, heppy_batch::val, and relativeConstraints::value.

136  {
137  const auto &data = table.columnData<T>(icol);
138  for (unsigned int i = 0, n = data.size(); i < n; ++i) {
139  if (rowsel[i]) {
140  const T val = data[i];
141  if constexpr (std::is_integral<T>::value) {
142  if (bitset_) {
143  for (unsigned int b = 0; b < std::numeric_limits<T>::digits; b++) {
144  if ((val >> b) & 0b1)
145  plot_->Fill(b);
146  }
147  } else {
148  plot_->Fill(val);
149  }
150  } else {
151  plot_->Fill(val);
152  }
153  }
154  }
155  }
weight_default_t b1[25]
Definition: b1.h:9
void Fill(long long x)
double b
Definition: hdecay.h:120
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
long double T
MonitorElement * plot_
Definition: NanoAODDQM.cc:68

Member Data Documentation

◆ bitset_

bool NanoAODDQM::Plot1D::bitset_
protected

Definition at line 134 of file NanoAODDQM.cc.

Referenced by vfill().

◆ col_

std::string NanoAODDQM::Plot1D::col_
protected

Definition at line 133 of file NanoAODDQM.cc.

Referenced by fill().