26 namespace pathelpers {
44 auto previousMin =
min.load();
45 while (previousMin > size and not
min.compare_exchange_weak(previousMin, size)) {
47 auto previousMax =
max.load();
48 while (previousMax < size and not
max.compare_exchange_weak(previousMax, size)) {
57 :
perEvent_(iConfig.getUntrackedParameter<bool>(
"perEvent",
false)),
58 perJob_(iConfig.getUntrackedParameter<bool>(
"perJob",
true)),
59 self_(iConfig.getParameter<std::
string>(
"@module_label")),
63 const std::vector<edm::InputTag>&
tags = iConfig.
getParameter<std::vector<edm::InputTag> >(
"candidates");
64 for (
const auto&
tag : tags) {
84 return std::make_unique<pathelpers::RecordCache>(conf);
92 std::vector<std::pair<edm::InputTag, edm::EDGetTokenT<edm::View<reco::Candidate> > > >
srcTokens;
97 const std::vector<edm::InputTag>&
inputs = iConfig.
getParameter<std::vector<edm::InputTag> >(
"candidates");
98 for (std::vector<edm::InputTag>::const_iterator it = inputs.begin(); it != inputs.end(); ++it) {
109 using std::setprecision;
113 if (globalCache()->perEvent_) {
114 LogInfo(globalCache()->logName_) <<
"Per Event Table " << globalCache()->logName_ <<
" (" << globalCache()->self_
115 <<
", run:event " << iEvent.
id().
run() <<
":" << iEvent.
id().
event() <<
")";
117 ++(globalCache()->totalEvents_);
118 auto& collections = globalCache()->collections_;
119 auto tags = srcTokens.cbegin();
120 for (
auto it = collections.begin(), ed = collections.end(); it != ed; ++it, ++
tags) {
124 if (globalCache()->perEvent_) {
125 LogVerbatim(globalCache()->logName_) <<
" " << setw(30) << left << it->src.encode() << right;
126 if (globalCache()->dumpItems_) {
128 std::ostringstream oss;
131 oss <<
" [" << setw(3) << i <<
"]"
132 <<
" pt " << setw(7) << setprecision(5) << cand->pt() <<
" eta " << setw(7) << setprecision(5)
133 << cand->eta() <<
" phi " << setw(7) << setprecision(5) << cand->phi() <<
" et " << setw(7)
134 << setprecision(5) << cand->et() <<
" phi " << setw(7) << setprecision(5) << cand->phi() <<
" charge "
135 << setw(2) << cand->charge() <<
" id " << setw(7) << cand->pdgId() <<
" st " << setw(7)
136 << cand->status() <<
"\n";
142 if (globalCache()->perEvent_)
143 LogInfo(globalCache()->logName_) <<
"";
149 using std::setprecision;
152 std::ostringstream oss;
155 oss <<
" " << setw(30) << left << it->src.encode() << right <<
" present " << setw(7) << it->present <<
" ("
156 << setw(4) << setprecision(3) << (it->present * 100.0 / rcd->
totalEvents_) <<
"%)"
157 <<
" empty " << setw(7) << it->empty <<
" (" << setw(4) << setprecision(3)
159 <<
" min " << setw(7) << it->min <<
" max " << setw(7) << it->max <<
" total " << setw(7) << it->total
160 <<
" avg " << setw(5) << setprecision(3) << (it->total / double(rcd->
totalEvents_)) <<
"\n";
std::vector< Record > collections_
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
static std::unique_ptr< pathelpers::RecordCache > initializeGlobalCache(edm::ParameterSet const &conf)
const std::string logName_
CandidateSummaryTable(const edm::ParameterSet &iConfig, const pathelpers::RecordCache *)
std::atomic< size_t > total
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Record(const Record &other)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Record(const edm::InputTag &tag)
#define DEFINE_FWK_MODULE(type)
std::atomic< size_t > totalEvents_
RecordCache(const edm::ParameterSet &iConfig)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Produce a summary table of some candidate collections.
static void globalEndJob(const pathelpers::RecordCache *)
std::vector< std::pair< edm::InputTag, edm::EDGetTokenT< edm::View< reco::Candidate > > > > srcTokens
std::atomic< size_t > empty
~CandidateSummaryTable() override
Log< level::Info, false > LogInfo
std::atomic< size_t > present
T getParameter(std::string const &) const
std::atomic< size_t > max
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void update(const edm::View< reco::Candidate > &items) const
tuple size
Write out results.
std::atomic< size_t > min