|
|
Go to the documentation of this file.
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) {
206 return me->getIntValue();
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);
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}};
293 edm::LogInfo(MsgLoggerCat) <<
"\n===============================\n"
294 <<
"Initialized as EDAnalyzer with parameter values:\n"
295 <<
" Name = " <<
name <<
"\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");
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);
void endRunProduce(edm::Run &run, edm::EventSetup const &setup) override
MonitorElement * bookFloat(TString const &name, 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())
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
edm::EDPutTokenT< DQMToken > dqmLumiToken_
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_
void set(const edm::InputTag &runInputTag, const edm::InputTag &lumiInputTag, edm::ConsumesCollector &iC)
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())
void getData(const edm::Run &iRun, edm::Handle< Product > &handle) const
virtual void setCurrentFolder(std::string const &fullpath)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void meBookerGetter(iFunc f)
T getUntrackedParameter(std::string const &, T const &) const
Log< level::Info, false > LogInfo
MonitorElementData::Scope reScope
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void put(std::unique_ptr< PROD > product)
Put a new product.
def split(sequence, size)
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
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())
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
EDMtoMEConverter(const edm::ParameterSet &)
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
void put(std::unique_ptr< PROD > product)
Put a new product.
void endLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
dqm::reco::DQMStore DQMStore
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())
~EDMtoMEConverter() override
virtual MonitorElement * get(std::string const &fullpath) const
T getParameter(std::string const &) const
edm::EDPutTokenT< DQMToken > dqmRunToken_
dqm::legacy::MonitorElement MonitorElement
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 * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())