50 edm::one::WatchLuminosityBlocks,
51 edm::one::SharedResources,
52 edm::EndLuminosityBlockProducer,
53 edm::EndRunProducer> {
102 std::tuple<Tokens<TH1F>,
127 template <
typename T>
135 template <
typename T>
140 template <
typename T>
147 template <
size_t I,
size_t N>
148 struct ForEachHelper {
149 template <
typename Tuple,
typename Func>
150 static void call(Tuple &&tpl, Func &&
func) {
151 func(std::get<I - 1>(tpl));
152 ForEachHelper<I + 1, N>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
157 struct ForEachHelper<
N,
N> {
158 template <
typename Tuple,
typename Func>
159 static void call(Tuple &&tpl, Func &&
func) {
160 func(std::get<N - 1>(tpl));
165 template <
typename Tuple,
typename Func>
166 void for_each(Tuple &&tpl, Func &&
func) {
168 ForEachHelper<1, size>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
171 template <
typename T>
174 struct HistoTraits<TH1F> {
176 template <
typename...
Args>
178 return iBooker.
book1D(std::forward<Args>(
args)...);
182 struct HistoTraits<TH1S> {
184 template <
typename...
Args>
186 return iBooker.
book1S(std::forward<Args>(
args)...);
190 struct HistoTraits<TH1D> {
192 template <
typename...
Args>
194 return iBooker.
book1DD(std::forward<Args>(
args)...);
198 struct HistoTraits<TH1I> {
200 template <
typename...
Args>
202 return iBooker.
book1I(std::forward<Args>(
args)...);
206 struct HistoTraits<TH2F> {
208 template <
typename...
Args>
210 return iBooker.
book2D(std::forward<Args>(
args)...);
214 struct HistoTraits<TH2S> {
216 template <
typename...
Args>
218 return iBooker.
book2S(std::forward<Args>(
args)...);
222 struct HistoTraits<TH2D> {
224 template <
typename...
Args>
226 return iBooker.
book2DD(std::forward<Args>(
args)...);
230 struct HistoTraits<TH2I> {
232 template <
typename...
Args>
234 return iBooker.
book2I(std::forward<Args>(
args)...);
238 struct HistoTraits<TH3F> {
240 template <
typename...
Args>
242 return iBooker.
book3D(std::forward<Args>(
args)...);
246 struct HistoTraits<TProfile> {
248 template <
typename...
Args>
254 struct HistoTraits<TProfile2D> {
256 template <
typename...
Args>
263 template <
typename T>
264 struct AddMonitorElement {
265 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
268 MEtoEDMObject_object *metoedmobject,
271 const RunOrLumi &runOrLumi) {
278 list.Add(metoedmobject);
279 if (
histo->Merge(&list) == -1)
280 edm::LogError(
"EDMtoMEConverter") <<
"ERROR EDMtoMEConverter::getData(): merge failed for '" 281 << metoedmobject->GetName() <<
"'" << std::endl;
285 return HistoTraits<T>::book(iBooker, metoedmobject->GetName(), metoedmobject);
291 struct AddMonitorElement<double> {
292 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
295 MEtoEDMObject_object *metoedmobject,
298 const RunOrLumi &runOrLumi) {
301 me->Fill(*metoedmobject);
307 template <
typename T>
308 struct AddMonitorElementForIntegers {
309 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
312 MEtoEDMObject_object *metoedmobject,
315 const RunOrLumi &runOrLumi) {
318 T ival = getProcessedEvents(iGetter,
dir,
name, runOrLumi);
320 me->Fill(*metoedmobject + ival);
328 if (
name.find(
"processedEvents") != std::string::npos) {
330 return me->getIntValue();
344 struct AddMonitorElement<long long> {
345 template <
typename...
Args>
347 return AddMonitorElementForIntegers<long long>::call(std::forward<Args>(
args)...);
351 struct AddMonitorElement<
int> {
352 template <
typename...
Args>
354 return AddMonitorElementForIntegers<int>::call(std::forward<Args>(
args)...);
359 struct AddMonitorElement<TString> {
360 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
363 MEtoEDMObject_object *metoedmobject,
366 const RunOrLumi &runOrLumi) {
375 if (
reScope == MonitorElementData::Scope::JOB) {
376 ibooker.
setScope(MonitorElementData::Scope::JOB);
378 ibooker.
setScope(MonitorElementData::Scope::RUN);
395 constexpr char MsgLoggerCat[] =
"EDMtoMEConverter_EDMtoMEConverter";
405 auto scopeDecode = std::map<std::string, MonitorElementData::Scope>{{
"", MonitorElementData::Scope::LUMI},
406 {
"LUMI", MonitorElementData::Scope::LUMI},
407 {
"RUN", MonitorElementData::Scope::RUN},
408 {
"JOB", MonitorElementData::Scope::JOB}};
417 edm::LogInfo(MsgLoggerCat) <<
"\n===============================\n" 418 <<
"Initialized as EDAnalyzer with parameter values:\n" 419 <<
" Name = " <<
name <<
"\n" 422 <<
"===============================\n";
425 assert(
sizeof(int64_t) ==
sizeof(
long long));
426 usesResource(
"DQMStore");
428 dqmLumiToken_ = produces<DQMToken, edm::Transition::EndLuminosityBlock>(
"endLumi");
429 dqmRunToken_ = produces<DQMToken, edm::Transition::EndRun>(
"endRun");
438 iRun.
put(dqmRunToken_, std::make_unique<DQMToken>());
447 iLumi.
put(dqmLumiToken_, std::make_unique<DQMToken>());
452 constexpr char MsgLoggerCat[] =
"EDMtoMEConverter_getData";
455 edm::LogInfo(MsgLoggerCat) <<
"\nRestoring MonitorElements.";
457 for_each(
tokens_, [&](
const auto &tok) {
460 using MEtoEDM_T =
typename Tokens_T::Product;
462 tok.getData(iGetFrom, metoedm);
469 std::vector<typename MEtoEDM_T::MEtoEDMObject> metoedmobject = metoedm->getMEtoEdmObject();
471 for (
unsigned int i = 0;
i < metoedmobject.size(); ++
i) {
485 adjustScope(iBooker, iGetFrom,
reScope);
486 AddMonitorElement<METype>::call(iBooker, iGetter, &metoedmobject[
i].
object,
dir,
name, iGetFrom);
T getParameter(std::string 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())
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
virtual void setCurrentFolder(std::string const &fullpath)
void endLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) override
dqm::legacy::DQMStore DQMStore
EDMtoMEConverter(const edm::ParameterSet &)
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
void beginRun(const edm::Run &, const edm::EventSetup &) final
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
dqm::legacy::MonitorElement MonitorElement
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
T getUntrackedParameter(std::string const &, T const &) const
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())
edm::EDGetTokenT< Product > runToken
void endRun(const edm::Run &, const edm::EventSetup &) final
~EDMtoMEConverter() override=default
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())
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, edm::EventSetup const &) final
edm::EDPutTokenT< DQMToken > dqmRunToken_
void getData(const edm::Run &iRun, edm::Handle< Product > &handle) const
void meBookerGetter(iFunc f)
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
#define DEFINE_FWK_MODULE(type)
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_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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())
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void put(std::unique_ptr< PROD > product)
Put a new product.
virtual MonitorElement * get(std::string const &fullpath) const
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
std::vector< uint32_t > TagList
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
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())
edm::EDGetTokenT< Product > lumiToken
MonitorElementData::Scope reScope