39 template <
size_t I,
size_t N>
40 struct ForEachHelper {
41 template <
typename Tuple,
typename Func>
42 static void call(Tuple &&tpl, Func &&
func) {
43 func(std::get<I - 1>(tpl));
44 ForEachHelper<I + 1, N>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
49 struct ForEachHelper<
N,
N> {
50 template <
typename Tuple,
typename Func>
51 static void call(Tuple &&tpl, Func &&
func) {
52 func(std::get<N - 1>(tpl));
57 template <
typename Tuple,
typename Func>
58 void for_each(Tuple &&tpl, Func &&
func) {
60 ForEachHelper<1, size>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
66 struct HistoTraits<TH1F> {
68 template <
typename...
Args>
70 return iBooker.
book1D(std::forward<Args>(
args)...);
74 struct HistoTraits<TH1S> {
76 template <
typename...
Args>
78 return iBooker.
book1S(std::forward<Args>(
args)...);
82 struct HistoTraits<TH1D> {
84 template <
typename...
Args>
86 return iBooker.
book1DD(std::forward<Args>(
args)...);
90 struct HistoTraits<TH2F> {
92 template <
typename...
Args>
94 return iBooker.
book2D(std::forward<Args>(
args)...);
98 struct HistoTraits<TH2S> {
100 template <
typename...
Args>
102 return iBooker.
book2S(std::forward<Args>(
args)...);
106 struct HistoTraits<TH2D> {
108 template <
typename...
Args>
110 return iBooker.
book2DD(std::forward<Args>(
args)...);
114 struct HistoTraits<TH3F> {
116 template <
typename...
Args>
118 return iBooker.
book3D(std::forward<Args>(
args)...);
122 struct HistoTraits<TProfile> {
124 template <
typename...
Args>
130 struct HistoTraits<TProfile2D> {
132 template <
typename...
Args>
139 template <
typename T>
140 struct AddMonitorElement {
141 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
144 MEtoEDMObject_object *metoedmobject,
147 const RunOrLumi &runOrLumi) {
154 list.Add(metoedmobject);
155 if (
histo->Merge(&list) == -1)
156 edm::LogError(
"EDMtoMEConverter") <<
"ERROR EDMtoMEConverter::getData(): merge failed for '"
157 << metoedmobject->GetName() <<
"'" << std::endl;
161 return HistoTraits<T>::book(iBooker, metoedmobject->GetName(), metoedmobject);
167 struct AddMonitorElement<double> {
168 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
171 MEtoEDMObject_object *metoedmobject,
174 const RunOrLumi &runOrLumi) {
177 me->
Fill(*metoedmobject);
183 template <
typename T>
184 struct AddMonitorElementForIntegers {
185 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
188 MEtoEDMObject_object *metoedmobject,
191 const RunOrLumi &runOrLumi) {
194 T ival = getProcessedEvents(iGetter, dir, name, runOrLumi);
196 me->
Fill(*metoedmobject + ival);
204 if (name.find(
"processedEvents") != std::string::npos) {
220 struct AddMonitorElement<long long> {
221 template <
typename...
Args>
223 return AddMonitorElementForIntegers<long long>::call(std::forward<Args>(
args)...);
227 struct AddMonitorElement<int> {
228 template <
typename...
Args>
230 return AddMonitorElementForIntegers<int>::call(std::forward<Args>(
args)...);
235 struct AddMonitorElement<TString> {
236 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
239 MEtoEDMObject_object *metoedmobject,
242 const RunOrLumi &runOrLumi) {
251 if (reScope == MonitorElementData::Scope::JOB) {
252 ibooker.
setScope(MonitorElementData::Scope::JOB);
254 ibooker.
setScope(MonitorElementData::Scope::RUN);
269 for_each(
tokens_, [&](
auto &tok) { tok.set(runInputTag, lumiInputTag, iC); });
271 constexpr
char MsgLoggerCat[] =
"EDMtoMEConverter_EDMtoMEConverter";
281 auto scopeDecode = std::map<std::string, MonitorElementData::Scope>{{
"", MonitorElementData::Scope::LUMI},
282 {
"LUMI", MonitorElementData::Scope::LUMI},
283 {
"RUN", MonitorElementData::Scope::RUN},
284 {
"JOB", MonitorElementData::Scope::JOB}};
292 if (verbosity >= 0) {
293 edm::LogInfo(MsgLoggerCat) <<
"\n===============================\n"
294 <<
"Initialized as EDAnalyzer with parameter values:\n"
295 <<
" Name = " << name <<
"\n"
296 <<
" Verbosity = " << verbosity <<
"\n"
297 <<
" Frequency = " << frequency <<
"\n"
298 <<
"===============================\n";
301 assert(
sizeof(int64_t) ==
sizeof(
long long));
302 usesResource(
"DQMStore");
304 dqmLumiToken_ = produces<DQMToken, edm::Transition::EndLuminosityBlock>(
"endLumi");
305 dqmRunToken_ = produces<DQMToken, edm::Transition::EndRun>(
"endRun");
311 if (convertOnEndRun) {
316 iRun.
put(dqmRunToken_, std::make_unique<DQMToken>());
320 if (convertOnEndLumi) {
325 iLumi.
put(dqmLumiToken_, std::make_unique<DQMToken>());
330 constexpr
char MsgLoggerCat[] =
"EDMtoMEConverter_getData";
333 edm::LogInfo(MsgLoggerCat) <<
"\nRestoring MonitorElements.";
335 for_each(
tokens_, [&](
const auto &tok) {
338 using MEtoEDM_T =
typename Tokens_T::Product;
340 tok.getData(iGetFrom, metoedm);
347 std::vector<typename MEtoEDM_T::MEtoEDMObject> metoedmobject = metoedm->getMEtoEdmObject();
349 for (
unsigned int i = 0;
i < metoedmobject.size(); ++
i) {
361 for (
unsigned j = 0;
j < fulldir.size() - 1; ++
j) {
363 if (
j != fulldir.size() - 2)
368 adjustScope(iBooker, iGetFrom, reScope);
369 AddMonitorElement<METype>::call(iBooker, iGetter, &metoedmobject[
i].
object, dir, name, iGetFrom);
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
virtual void setCurrentFolder(std::string const &fullpath)
void endLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
EDMtoMEConverter(const edm::ParameterSet &)
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
virtual int64_t getIntValue() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
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 g
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
~EDMtoMEConverter() override
dqm::reco::DQMStore DQMStore
void endRunProduce(edm::Run &run, edm::EventSetup const &setup) override
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDPutTokenT< DQMToken > dqmRunToken_
virtual MonitorElement * get(std::string const &fullpath) const
void meBookerGetter(iFunc f)
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
std::tuple< Tokens< TH1F >, Tokens< TH1S >, Tokens< TH1D >, Tokens< TH2F >, Tokens< TH2S >, Tokens< TH2D >, Tokens< TH3F >, Tokens< TProfile >, Tokens< TProfile2D >, Tokens< double >, Tokens< int >, Tokens< long long >, Tokens< TString > > tokens_
edm::EDPutTokenT< DQMToken > dqmLumiToken_
Log< level::Info, false > LogInfo
std::vector< edm::EDGetTokenT< int > > tokens_
dqm::legacy::MonitorElement MonitorElement
void set(const edm::InputTag &runInputTag, const edm::InputTag &lumiInputTag, edm::ConsumesCollector &iC)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
void put(std::unique_ptr< PROD > product)
Put a new product.
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
void getData(const edm::Run &iRun, edm::Handle< Product > &handle) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
tuple size
Write out results.