40 const size_t size =
items.size();
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)) {
63 const std::vector<edm::InputTag>&
tags = iConfig.
getParameter<std::vector<edm::InputTag> >(
"candidates");
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_);
119 auto tags = srcTokens.cbegin();
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
static std::unique_ptr< pathelpers::RecordCache > initializeGlobalCache(edm::ParameterSet const &conf)
T getParameter(std::string const &) const
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)
Record(const edm::InputTag &tag)
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
#define DEFINE_FWK_MODULE(type)
std::atomic< size_t > empty
void update(const edm::View< reco::Candidate > &items) const
~CandidateSummaryTable() override
Log< level::Info, false > LogInfo
std::atomic< size_t > present
std::atomic< size_t > max
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::atomic< size_t > min