29 #include <boost/foreach.hpp>
30 #define foreach BOOST_FOREACH
34 edm::one::WatchLuminosityBlocks,
35 edm::EndLuminosityBlockProducer> {
46 virtual void endJob()
override;
58 typedef std::vector<edm::ErrorSummaryEntry>
ErrorList;
59 typedef std::set<edm::ErrorSummaryEntry,ErrorSort>
ErrorSet;
70 std::map<std::pair<uint32_t,uint32_t>, std::pair<size_t,size_t> >
statsPerLumi_;
80 template<
typename Collection>
static void print(
const Collection &
errors) ;
83 std::auto_ptr<ErrorList>
ret(
new ErrorList(set.begin(), set.end()));
89 src_(iConfig.getParameter<edm::
InputTag>(
"src")),
91 readSummaryMode_(iConfig.existsAs<bool>(
"readSummaryMode") ? iConfig.getParameter<bool>(
"readSummaryMode") :
false),
92 thresholdPerLumi_(iConfig.getParameter<double>(
"maxErrorFractionInLumi")),
93 thresholdPerRun_(iConfig.getParameter<double>(
"maxErrorFractionInRun")),
94 maxSavedEventsPerLumi_(iConfig.getParameter<uint32_t>(
"maxSavedEventsPerLumiAndError")),
95 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
96 veryVerbose_(iConfig.getUntrackedParameter<bool>(
"veryVerbose",
false)),
97 taggedMode_(iConfig.getUntrackedParameter<bool>(
"taggedMode",
false)),
98 forcedValue_(iConfig.getUntrackedParameter<bool>(
"forcedValue",
true))
100 produces<ErrorList, edm::InLumi>();
101 produces<int, edm::InLumi>(
"pass");
102 produces<int, edm::InLumi>(
"fail");
106 if (iConfig.
existsAs<std::vector<std::string> >(
"modulesToWatch")) {
107 std::vector<std::string>
modules = iConfig.
getParameter<std::vector<std::string> >(
"modulesToWatch");
108 if (!(modules.size() == 1 && modules[0] ==
"*")) {
112 if (iConfig.
existsAs<std::vector<std::string> >(
"modulesToIgnore")) {
113 std::vector<std::string>
modules = iConfig.
getParameter<std::vector<std::string> >(
"modulesToIgnore");
114 if (!(modules.size() == 1 && modules[0] ==
"*")) {
118 if (iConfig.
existsAs<std::vector<std::string> >(
"categoriesToWatch")) {
119 std::vector<std::string>
categories = iConfig.
getParameter<std::vector<std::string> >(
"categoriesToWatch");
120 if (!(categories.size() == 1 && categories[0] ==
"*")) {
124 if (iConfig.
existsAs<std::vector<std::string> >(
"categoriesToIgnore")) {
125 std::vector<std::string>
categories = iConfig.
getParameter<std::vector<std::string> >(
"categoriesToIgnore");
126 if (!(categories.size() == 1 && categories[0] ==
"*")) {
173 std::auto_ptr<int> outpass(
new int(
npassLumi_)); lumi.
put(outpass,
"pass");
174 std::auto_ptr<int> outfail(
new int(
nfailLumi_)); lumi.
put(outfail,
"fail");
192 std::cout <<
"\n === REPORT FOR RUN " << run.
run() <<
" === " << std::endl;
202 std::cout <<
"\n === REPORT FOR JOB === " << std::endl;
205 typedef std::pair<size_t,size_t>
counter;
207 std::cout <<
"\n === SCOREBOARD PER RUN === " << std::endl;
208 typedef std::pair<uint32_t, counter> hitRun;
210 double fract = hit.second.second/double(hit.second.first + hit.second.second);
211 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)" :
""));
214 std::cout <<
"\n === SCOREBOARD PER LUMI === " << std::endl;
215 typedef std::pair<std::pair<uint32_t,uint32_t>, counter> hitLumi;
217 double fract = hit.second.second/double(hit.second.first + hit.second.second);
218 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)" :
""));
233 if (errors->empty()) {
235 iEvent.
put( std::auto_ptr<bool>(
new bool(
false)) );
241 foreach (
const Error &err, *errors) {
249 if (!result.second) {
251 const_cast<unsigned int &
>(result.first->count) += err.
count;
265 iEvent.
put( std::auto_ptr<bool>(
new bool(fail)) );
271 template<
typename Collection>
274 foreach (
const Error &err, list) {
275 std::pair<ErrorSet::iterator, bool>
result = scoreboard.insert(err);
277 if (!result.second)
const_cast<unsigned int &
>(result.first->count) += err.
count;
281 template<
typename Collection>
285 cout << setw(40) << left <<
"Category" <<
" " <<
286 setw(60) << left <<
"Module" <<
" " <<
287 setw(10) << left <<
"Level" <<
" " <<
288 setw(9) << right <<
"Count" <<
"\n";
289 cout << setw(40) << left <<
"----------------------------------------" <<
" " <<
290 setw(60) << left <<
"------------------------------------------------------------" <<
" " <<
291 setw(10) << left <<
"----------" <<
" " <<
292 setw(9) << right <<
"---------" <<
"\n";
293 foreach (
const Error &err, errors) {
295 setw(60) << left << err.
module <<
" " <<
297 setw(9) << right << err.
count <<
"\n";
bool operator()(const Error &e1, const Error &e2)
T getParameter(std::string const &) const
EventNumber_t event() const
static void print(const Collection &errors)
std::set< std::string > categoriesToIgnore_
std::set< std::string > modulesToWatch_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::ErrorSummaryEntry Error
std::set< edm::ErrorSummaryEntry, ErrorSort > ErrorSet
#define DEFINE_FWK_MODULE(type)
virtual void endRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::LuminosityBlockNumber_t luminosityBlock() const
static std::auto_ptr< ErrorList > serialize(const ErrorSet &set)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
ErrorSet errorCollectionThisRun_
LuminosityBlockNumber_t luminosityBlock() const
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) override
virtual bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ErrorSet errorCollectionThisLumi_
static void increment(ErrorSet &scoreboard, Collection &list)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void endJob() override
virtual ~LogErrorEventFilter()
const ELstring getName() const
if(c.getParameter< edm::InputTag >("puppiValueMap").label().size()!=0)
ErrorSet errorCollectionAll_
const Fraction< n, m >::type & fract()
std::vector< edm::ErrorSummaryEntry > ErrorList
std::map< uint32_t, std::pair< size_t, size_t > > statsPerRun_
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_
virtual void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
size_t maxSavedEventsPerLumi_
static std::atomic< unsigned int > counter
volatile std::atomic< bool > shutdown_flag false
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) override
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
void put(std::auto_ptr< PROD > product)
Put a new product.
LogErrorEventFilter(const edm::ParameterSet &iConfig)