39 using ErrorSet = std::set<edm::ErrorSummaryEntry,ErrorSort>;
43 npass_{0}, nfail_{0}, collectionGuard_{
false} {}
48 mutable
std::atomic<
size_t> npass_;
49 mutable
std::atomic<
size_t> nfail_;
51 mutable
std::atomic<
bool> collectionGuard_;
56 npass_{0}, nfail_{0}, collectionGuard_{
false} {}
59 mutable
std::atomic<
size_t> npass_;
60 mutable
std::atomic<
size_t> nfail_;
62 mutable
std::atomic<
bool> collectionGuard_;
72 std::unique_ptr<std::atomic<bool>,
release> make_guard(std::atomic<bool>&
b)
noexcept {
73 bool expected =
false;
74 while( not b.compare_exchange_strong(expected,
true) );
84 edm::LuminosityBlockCache<LumiErrors>,
85 edm::EndLuminosityBlockProducer> {
96 void endJob()
override;
112 double thresholdPerLumi_, thresholdPerRun_;
113 size_t maxSavedEventsPerLumi_;
114 bool verbose_, veryVerbose_;
115 bool taggedMode_, forcedValue_;
116 mutable
std::atomic<
bool> statsGuard_;
122 return std::make_unique<ErrorList>(
set.begin(),
set.end());
127 src_(iConfig.getParameter<
edm::InputTag>(
"src")),
128 srcT_(consumes<
ErrorList>(iConfig.getParameter<
edm::InputTag>(
"src"))),
129 readSummaryMode_(iConfig.existsAs<
bool>(
"readSummaryMode") ? iConfig.getParameter<
bool>(
"readSummaryMode") :
false),
130 thresholdPerLumi_(iConfig.getParameter<double>(
"maxErrorFractionInLumi")),
131 thresholdPerRun_(iConfig.getParameter<double>(
"maxErrorFractionInRun")),
132 maxSavedEventsPerLumi_(iConfig.getParameter<uint32_t>(
"maxSavedEventsPerLumiAndError")),
133 verbose_(iConfig.getUntrackedParameter<
bool>(
"verbose",
false)),
134 veryVerbose_(iConfig.getUntrackedParameter<
bool>(
"veryVerbose",
false)),
135 taggedMode_(iConfig.getUntrackedParameter<
bool>(
"taggedMode",
false)),
136 forcedValue_(iConfig.getUntrackedParameter<
bool>(
"forcedValue",
true))
138 produces<ErrorList, edm::Transition::EndLuminosityBlock>();
139 produces<int, edm::Transition::EndLuminosityBlock>(
"pass");
140 produces<int, edm::Transition::EndLuminosityBlock>(
"fail");
144 if (iConfig.
existsAs<std::vector<std::string> >(
"modulesToWatch")) {
145 std::vector<std::string>
modules = iConfig.
getParameter<std::vector<std::string> >(
"modulesToWatch");
146 if (!(modules.size() == 1 && modules[0] ==
"*")) {
150 if (iConfig.
existsAs<std::vector<std::string> >(
"modulesToIgnore")) {
151 std::vector<std::string>
modules = iConfig.
getParameter<std::vector<std::string> >(
"modulesToIgnore");
152 if (!(modules.size() == 1 && modules[0] ==
"*")) {
156 if (iConfig.
existsAs<std::vector<std::string> >(
"categoriesToWatch")) {
157 std::vector<std::string>
categories = iConfig.
getParameter<std::vector<std::string> >(
"categoriesToWatch");
158 if (!(categories.size() == 1 && categories[0] ==
"*")) {
162 if (iConfig.
existsAs<std::vector<std::string> >(
"categoriesToIgnore")) {
163 std::vector<std::string>
categories = iConfig.
getParameter<std::vector<std::string> >(
"categoriesToIgnore");
164 if (!(categories.size() == 1 && categories[0] ==
"*")) {
177 std::shared_ptr<LumiErrors>
179 auto ret = std::make_shared<LumiErrors>();
186 increment(ret->errorCollection_, *handle);
187 ret->npass_ = *hpass;
188 ret->nfail_ = *hfail;
191 runC->npass_ +=*hpass;
192 runC->nfail_ += *hfail;
198 auto lumiC = luminosityBlockCache(lumi.
index());
199 auto nfail = lumiC->nfail_.load();
200 auto npass = lumiC->npass_.load();
207 auto guard = make_guard(lumiC->collectionGuard_);
213 auto guard = make_guard(runC->collectionGuard_);
214 increment(runC->errorCollection_, lumiC->errorCollection_);
218 if (!lumiC->errorCollection_.empty()) {
220 print(lumiC->errorCollection_);
228 auto lumiC = luminosityBlockCache(lumi.
index());
231 auto guard = make_guard(lumiC->collectionGuard_);
234 lumi.
put(std::make_unique<int>(lumiC->npass_.load()),
"pass");
235 lumi.
put(std::make_unique<int>(lumiC->nfail_.load()),
"fail");
239 std::shared_ptr<RunErrors>
241 return std::make_shared<RunErrors>();
246 auto runC = runCache(run.
index());
247 auto npass = runC->npass_.load();
248 auto nfail = runC->nfail_.load();
255 auto guard = make_guard(runC->collectionGuard_);
261 if (!runC->errorCollection_.empty()) {
262 std::cout <<
"\n === REPORT FOR RUN " << run.
run() <<
" === " << std::endl;
263 print(runC->errorCollection_);
272 std::cout <<
"\n === REPORT FOR JOB === " << std::endl;
277 typedef std::pair<size_t,size_t>
counter;
279 std::cout <<
"\n === SCOREBOARD PER RUN === " << std::endl;
280 typedef std::pair<uint32_t, counter> hitRun;
282 double fract =
hit.second.second/double(
hit.second.first +
hit.second.second);
283 printf(
"run %6d: fail %7zu, pass %7zu, fraction %7.3f%%%s\n",
hit.first,
hit.second.second,
hit.second.first, fract*100., (fract >=
thresholdPerRun_ ?
" (run excluded from summary list)" :
""));
286 std::cout <<
"\n === SCOREBOARD PER LUMI === " << std::endl;
287 typedef std::pair<std::pair<uint32_t,uint32_t>, counter> hitLumi;
289 double fract =
hit.second.second/double(
hit.second.first +
hit.second.second);
290 printf(
"run %6d, lumi %4d: fail %zu, pass %zu, fraction %7.3f%%%s\n",
hit.first.first,
hit.first.second,
hit.second.second,
hit.second.first, fract*100., (fract >=
thresholdPerLumi_ ?
" (lumi excluded from run list)" :
""));
307 if (errors->empty()) {
310 iEvent.
put(std::make_unique<bool>(
false));
316 for(
auto const& err : *errors) {
325 auto guard = make_guard(lumiC->collectionGuard_);
327 std::pair<ErrorSet::iterator, bool>
result = lumiC->errorCollection_.insert(err);
328 if (!result.second) {
330 const_cast<unsigned int &
>(result.first->count) += err.count;
343 if (fail) { ++(lumiC->nfail_); ++(runC->nfail_); }
else { ++(runC->npass_); ++(lumiC->npass_); }
344 iEvent.
put(std::make_unique<bool>(fail));
350 template<
typename Collection>
353 for(
auto const& err : list) {
354 std::pair<ErrorSet::iterator, bool>
result = scoreboard.insert(err);
356 if (!result.second)
const_cast<unsigned int &
>(result.first->count) += err.count;
360 template<
typename Collection>
364 cout << setw(40) << left <<
"Category" <<
" " <<
365 setw(60) << left <<
"Module" <<
" " <<
366 setw(10) << left <<
"Level" <<
" " <<
367 setw(9) << right <<
"Count" <<
"\n";
368 cout << setw(40) << left <<
"----------------------------------------" <<
" " <<
369 setw(60) << left <<
"------------------------------------------------------------" <<
" " <<
370 setw(10) << left <<
"----------" <<
" " <<
371 setw(9) << right <<
"---------" <<
"\n";
372 for(
auto const& err : errors) {
373 cout << setw(40) << left << err.category <<
" " <<
374 setw(60) << left << err.module <<
" " <<
375 setw(10) << left << err.severity.getName() <<
" " <<
376 setw(9) << right << err.count <<
"\n";
std::shared_ptr< LumiErrors > globalBeginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) const override
std::set< edm::ErrorSummaryEntry, ErrorSort > ErrorSet
T getParameter(std::string const &) const
EventNumber_t event() const
static void print(const Collection &errors)
std::set< std::string > categoriesToIgnore_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::set< std::string > modulesToWatch_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::pair< Binary, Binary > serialize(const T &payload)
LuminosityBlockIndex index() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::ErrorSummaryEntry Error
std::shared_ptr< RunErrors > globalBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) const override
~LogErrorEventFilter() override
void globalEndLuminosityBlockProduce(edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) const override
edm::LuminosityBlockNumber_t luminosityBlock() const
Run const & getRun() const
static std::unique_ptr< ErrorList > serialize(const ErrorSet &set)
S & print(S &os, JobReport::InputFile const &f)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
LuminosityBlockNumber_t luminosityBlock() const
#define DEFINE_FWK_MODULE(type)
void globalEndRun(const edm::Run &run, const edm::EventSetup &iSetup) const override
static void increment(ErrorSet &scoreboard, Collection &list)
void put(std::unique_ptr< PROD > product)
Put a new product.
bool filter(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
std::atomic< bool > statsGuard_
#define CMS_THREAD_GUARD(_var_)
ErrorSet errorCollectionAll_
def template(fileName, svg, replaceme="REPLACEME")
bool operator()(const Error &e1, const Error &e2) const
LuminosityBlock const & getLuminosityBlock() const
const Fraction< n, m >::type & fract()
std::vector< edm::ErrorSummaryEntry > ErrorList
std::map< uint32_t, std::pair< size_t, size_t > > statsPerRun_
void globalEndLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) const override
std::set< std::string > categoriesToWatch_
std::set< std::string > modulesToIgnore_
std::map< std::pair< uint32_t, uint32_t >, std::pair< size_t, size_t > > statsPerLumi_
size_t maxSavedEventsPerLumi_
static std::atomic< unsigned int > counter
edm::EDGetTokenT< ErrorList > srcT_
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
LogErrorEventFilter(const edm::ParameterSet &iConfig)
Run const & getRun() const