35 template <
size_t I,
size_t N>
36 struct ForEachHelper {
37 template <
typename Tuple,
typename Func>
39 void call(Tuple&& tpl, Func&&
func) {
40 func(std::get<I-1>(tpl));
41 ForEachHelper<I+1, N>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
46 struct ForEachHelper<N, N> {
47 template <
typename Tuple,
typename Func>
49 void call(Tuple&& tpl, Func&&
func) {
50 func(std::get<N-1>(tpl));
55 template <
typename Tuple,
typename Func>
56 void for_each(Tuple&& tpl, Func&&
func) {
58 ForEachHelper<1, size>::call(std::forward<Tuple>(tpl), std::forward<Func>(
func));
62 template <
typename T>
struct HistoTraits;
63 template <>
struct HistoTraits<TH1F> {
66 return iBooker.
book1D(std::forward<Args>(
args)...);
69 template <>
struct HistoTraits<TH1S> {
72 return iBooker.
book1S(std::forward<Args>(
args)...);
75 template <>
struct HistoTraits<TH1D> {
78 return iBooker.
book1DD(std::forward<Args>(
args)...);
81 template <>
struct HistoTraits<TH2F> {
84 return iBooker.
book2D(std::forward<Args>(
args)...);
87 template <>
struct HistoTraits<TH2S> {
90 return iBooker.
book2S(std::forward<Args>(
args)...);
93 template <>
struct HistoTraits<TH2D> {
96 return iBooker.
book2DD(std::forward<Args>(
args)...);
99 template <>
struct HistoTraits<TH3F> {
102 return iBooker.
book3D(std::forward<Args>(
args)...);
105 template <>
struct HistoTraits<TProfile>{
106 static TProfile *
get(
MonitorElement *me) {
return me->getTProfile(); }
111 template <>
struct HistoTraits<TProfile2D> {
112 static TProfile2D *
get(
MonitorElement *me) {
return me->getTProfile2D(); }
119 template <
typename T>
120 struct AddMonitorElement {
121 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
130 list.Add(metoedmobject);
131 if (
histo->Merge(&list) == -1)
132 std::cout <<
"ERROR EDMtoMEConverter::getData(): merge failed for '" 133 << metoedmobject->GetName() <<
"'" << std::endl;
139 return HistoTraits<T>::book(iBooker, metoedmobject->GetName(), metoedmobject);
144 struct AddMonitorElement<double> {
145 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
150 me->
Fill(*metoedmobject);
156 template <
typename T>
157 struct AddMonitorElementForIntegers {
158 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
163 T ival = getProcessedEvents(iGetter, dir, name, runOrLumi);
165 me->
Fill(*metoedmobject + ival);
171 if(name.find(
"processedEvents") != std::string::npos) {
185 struct AddMonitorElement<long long> {
186 template <
typename ...Args>
189 return AddMonitorElementForIntegers<long long>::call(std::forward<Args>(
args)...);
193 struct AddMonitorElement<int> {
194 template <
typename ...Args>
197 return AddMonitorElementForIntegers<int>::call(std::forward<Args>(
args)...);
203 struct AddMonitorElement<TString> {
204 template <
typename MEtoEDMObject_
object,
typename RunOrLumi>
228 for_each(
tokens_, [&](
auto& tok) {
229 tok.set(runInputTag, lumiInputTag, iC);
232 constexpr char MsgLoggerCat[] =
"EDMtoMEConverter_EDMtoMEConverter";
247 if (verbosity >= 0) {
249 <<
"\n===============================\n" 250 <<
"Initialized as EDAnalyzer with parameter values:\n" 251 <<
" Name = " <<
name <<
"\n" 252 <<
" Verbosity = " << verbosity <<
"\n" 253 <<
" Frequency = " << frequency <<
"\n" 254 <<
"===============================\n";
257 assert(
sizeof(int64_t) ==
sizeof(
long long));
258 usesResource(
"DQMStore");
260 dqmLumiToken_ = produces<DQMToken,edm::Transition::EndLuminosityBlock>(
"endLumi");
261 dqmRunToken_ = produces<DQMToken,edm::Transition::EndRun>(
"endRun");
296 constexpr char MsgLoggerCat[] =
"EDMtoMEConverter_getData";
299 edm::LogInfo (MsgLoggerCat) <<
"\nRestoring MonitorElements.";
301 for_each(
tokens_, [&](
const auto& tok) {
304 using MEtoEDM_T =
typename Tokens_T::Product;
306 tok.getData(iGetFrom, metoedm);
313 std::vector<typename MEtoEDM_T::MEtoEDMObject> metoedmobject =
314 metoedm->getMEtoEdmObject();
316 for (
unsigned int i = 0;
i < metoedmobject.size(); ++
i) {
327 for (
unsigned j = 0; j < fulldir.size() - 1; ++j) {
329 if (j != fulldir.size() - 2) dir +=
"/";
333 MonitorElement *me = AddMonitorElement<METype>::call(iBooker, iGetter, &metoedmobject[
i].
object, dir, name, iGetFrom);
334 maybeSetLumiFlag(me, iGetFrom);
337 for(
const auto&
tag: metoedmobject[
i].tags) {
T getParameter(std::string const &) const
MonitorElement * book1S(Args &&...args)
T getUntrackedParameter(std::string const &, T const &) const
int64_t getIntValue() const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
void endLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) override
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
EDMtoMEConverter(const edm::ParameterSet &)
MonitorElement * bookInt(Args &&...args)
MonitorElement * bookString(Args &&...args)
void setCurrentFolder(std::string const &fullpath)
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
~EDMtoMEConverter() override
void endRunProduce(edm::Run &run, edm::EventSetup const &setup) override
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 setLumiFlag()
this ME is meant to be stored for each luminosity section
void setCurrentFolder(std::string const &fullpath)
MonitorElement * bookProfile2D(Args &&...args)
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_
MonitorElement * book1D(Args &&...args)
void tag(MonitorElement *, unsigned int)
MonitorElement * book2S(Args &&...args)
MonitorElement * get(std::string const &path)
edm::EDPutTokenT< DQMToken > dqmLumiToken_
MonitorElement * book2D(Args &&...args)
void set(const edm::InputTag &runInputTag, const edm::InputTag &lumiInputTag, edm::ConsumesCollector &iC)
void put(std::unique_ptr< PROD > product)
Put a new product.
MonitorElement * book2DD(Args &&...args)
MonitorElement * bookFloat(Args &&...args)
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
void getData(const edm::Run &iRun, edm::Handle< Product > &handle) const
MonitorElement * book3D(Args &&...args)
MonitorElement * book1DD(Args &&...args)
T get(const Candidate &c)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run