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<TH1I> {
92 template <
typename...
Args>
94 return iBooker.
book1I(std::forward<Args>(
args)...);
98 struct HistoTraits<TH2F> {
100 template <
typename...
Args>
102 return iBooker.
book2D(std::forward<Args>(
args)...);
106 struct HistoTraits<TH2S> {
108 template <
typename...
Args>
110 return iBooker.
book2S(std::forward<Args>(
args)...);
114 struct HistoTraits<TH2D> {
116 template <
typename...
Args>
118 return iBooker.
book2DD(std::forward<Args>(
args)...);
122 struct HistoTraits<TH2I> {
124 template <
typename...
Args>
126 return iBooker.
book2I(std::forward<Args>(
args)...);
130 struct HistoTraits<TH3F> {
132 template <
typename...
Args>
134 return iBooker.
book3D(std::forward<Args>(
args)...);
138 struct HistoTraits<TProfile> {
140 template <
typename...
Args>
146 struct HistoTraits<TProfile2D> {
148 template <
typename...
Args>
155 template <
typename T>
156 struct AddMonitorElement {
157 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
160 MEtoEDMObject_object *metoedmobject,
163 const RunOrLumi &runOrLumi) {
170 list.Add(metoedmobject);
171 if (
histo->Merge(&list) == -1)
172 edm::LogError(
"EDMtoMEConverter") <<
"ERROR EDMtoMEConverter::getData(): merge failed for '"
173 << metoedmobject->GetName() <<
"'" << std::endl;
177 return HistoTraits<T>::book(iBooker, metoedmobject->GetName(), metoedmobject);
183 struct AddMonitorElement<double> {
184 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
187 MEtoEDMObject_object *metoedmobject,
190 const RunOrLumi &runOrLumi) {
193 me->
Fill(*metoedmobject);
199 template <
typename T>
200 struct AddMonitorElementForIntegers {
201 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
204 MEtoEDMObject_object *metoedmobject,
207 const RunOrLumi &runOrLumi) {
210 T ival = getProcessedEvents(iGetter, dir, name, runOrLumi);
212 me->
Fill(*metoedmobject + ival);
220 if (name.find(
"processedEvents") != std::string::npos) {
236 struct AddMonitorElement<long long> {
237 template <
typename...
Args>
239 return AddMonitorElementForIntegers<long long>::call(std::forward<Args>(
args)...);
243 struct AddMonitorElement<int> {
244 template <
typename...
Args>
246 return AddMonitorElementForIntegers<int>::call(std::forward<Args>(
args)...);
251 struct AddMonitorElement<TString> {
252 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
255 MEtoEDMObject_object *metoedmobject,
258 const RunOrLumi &runOrLumi) {
267 if (reScope == MonitorElementData::Scope::JOB) {
268 ibooker.
setScope(MonitorElementData::Scope::JOB);
270 ibooker.
setScope(MonitorElementData::Scope::RUN);
285 for_each(
tokens_, [&](
auto &tok) { tok.set(runInputTag, lumiInputTag, iC); });
287 constexpr
char MsgLoggerCat[] =
"EDMtoMEConverter_EDMtoMEConverter";
297 auto scopeDecode = std::map<std::string, MonitorElementData::Scope>{{
"", MonitorElementData::Scope::LUMI},
298 {
"LUMI", MonitorElementData::Scope::LUMI},
299 {
"RUN", MonitorElementData::Scope::RUN},
300 {
"JOB", MonitorElementData::Scope::JOB}};
308 if (verbosity >= 0) {
309 edm::LogInfo(MsgLoggerCat) <<
"\n===============================\n"
310 <<
"Initialized as EDAnalyzer with parameter values:\n"
311 <<
" Name = " << name <<
"\n"
312 <<
" Verbosity = " << verbosity <<
"\n"
313 <<
" Frequency = " << frequency <<
"\n"
314 <<
"===============================\n";
317 assert(
sizeof(int64_t) ==
sizeof(
long long));
318 usesResource(
"DQMStore");
320 dqmLumiToken_ = produces<DQMToken, edm::Transition::EndLuminosityBlock>(
"endLumi");
321 dqmRunToken_ = produces<DQMToken, edm::Transition::EndRun>(
"endRun");
327 if (convertOnEndRun) {
332 iRun.
put(dqmRunToken_, std::make_unique<DQMToken>());
336 if (convertOnEndLumi) {
341 iLumi.
put(dqmLumiToken_, std::make_unique<DQMToken>());
346 constexpr
char MsgLoggerCat[] =
"EDMtoMEConverter_getData";
349 edm::LogInfo(MsgLoggerCat) <<
"\nRestoring MonitorElements.";
351 for_each(
tokens_, [&](
const auto &tok) {
354 using MEtoEDM_T =
typename Tokens_T::Product;
356 tok.getData(iGetFrom, metoedm);
363 std::vector<typename MEtoEDM_T::MEtoEDMObject> metoedmobject = metoedm->getMEtoEdmObject();
365 for (
unsigned int i = 0;
i < metoedmobject.size(); ++
i) {
377 for (
unsigned j = 0;
j < fulldir.size() - 1; ++
j) {
379 if (
j != fulldir.size() - 2)
384 adjustScope(iBooker, iGetFrom, reScope);
385 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 * book1I(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, 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())
edm::EDPutTokenT< DQMToken > dqmLumiToken_
Log< level::Info, false > LogInfo
std::vector< edm::EDGetTokenT< int > > tokens_
std::tuple< Tokens< TH1F >, Tokens< TH1S >, Tokens< TH1D >, Tokens< TH1I >, Tokens< TH2F >, Tokens< TH2S >, Tokens< TH2D >, Tokens< TH2I >, Tokens< TH3F >, Tokens< TProfile >, Tokens< TProfile2D >, Tokens< double >, Tokens< int >, Tokens< long long >, Tokens< TString > > 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())
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
tuple size
Write out results.