Public Member Functions | |
virtual void | analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) |
CandidateSummaryTable (const edm::ParameterSet &iConfig) | |
virtual void | endJob () |
~CandidateSummaryTable () | |
Private Attributes | |
std::vector< Record > | collections_ |
bool | dumpItems_ |
std::string | logName_ |
bool | perEvent_ |
bool | perJob_ |
std::string | self_ |
size_t | totalEvents_ |
Classes | |
struct | Record |
FIXME FIXME Move to CandAlgos
Definition at line 27 of file CandidateSummaryTable.cc.
pat::CandidateSummaryTable::CandidateSummaryTable | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 62 of file CandidateSummaryTable.cc.
References collections_, edm::ParameterSet::getParameter(), inputs, and it.
00062 : 00063 totalEvents_(0), 00064 perEvent_(iConfig.getUntrackedParameter<bool>("perEvent", false)), 00065 perJob_(iConfig.getUntrackedParameter<bool>("perJob", true)), 00066 self_(iConfig.getParameter<std::string>("@module_label")), 00067 logName_(iConfig.getUntrackedParameter<std::string>("logName")), 00068 dumpItems_(iConfig.getUntrackedParameter<bool>("dumpItems", false)) 00069 { 00070 std::vector<edm::InputTag> inputs = iConfig.getParameter<std::vector<edm::InputTag> >("candidates"); 00071 for (std::vector<edm::InputTag>::const_iterator it = inputs.begin(); it != inputs.end(); ++it) { 00072 collections_.push_back(Record(*it)); 00073 } 00074 }
pat::CandidateSummaryTable::~CandidateSummaryTable | ( | ) |
void pat::CandidateSummaryTable::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 80 of file CandidateSummaryTable.cc.
References collections_, dumpItems_, edm::Event::getByLabel(), i, edm::Event::id(), it, logName_, perEvent_, self_, and totalEvents_.
00080 { 00081 using namespace edm; 00082 using std::setw; using std::left; using std::right; using std::setprecision; 00083 00084 Handle<View<reco::Candidate> > candidates; 00085 if (perEvent_) { 00086 LogInfo(logName_) << "Per Event Table " << logName_ << 00087 " (" << self_ << ", run:event " << iEvent.id().run() << ":" << iEvent.id().event() << ")"; 00088 } 00089 totalEvents_++; 00090 for (std::vector<Record>::iterator it = collections_.begin(), ed = collections_.end(); it != ed; ++it) { 00091 iEvent.getByLabel(it->src, candidates); 00092 if (!candidates.failedToGet()) it->update(*candidates); 00093 if (perEvent_) { 00094 LogVerbatim(logName_) << " " << setw(30) << left << it->src.encode() << right; 00095 if (dumpItems_) { 00096 size_t i = 0; 00097 std::ostringstream oss; 00098 for (View<reco::Candidate>::const_iterator cand = candidates->begin(), endc = candidates->end(); cand != endc; ++cand, ++i) { 00099 oss << " [" << setw(3) << i << "]" << 00100 " pt " << setw(7) << setprecision(5) << cand->pt() << 00101 " eta " << setw(7) << setprecision(5) << cand->eta() << 00102 " phi " << setw(7) << setprecision(5) << cand->phi() << 00103 " et " << setw(7) << setprecision(5) << cand->et() << 00104 " phi " << setw(7) << setprecision(5) << cand->phi() << 00105 " charge " << setw(2) << cand->charge() << 00106 " id " << setw(7) << cand->pdgId() << 00107 " st " << setw(7) << cand->status() << "\n"; 00108 } 00109 LogVerbatim(logName_) << oss.str(); 00110 } 00111 } 00112 } 00113 if (perEvent_) LogInfo(logName_) << "" ; // add an empty line 00114 }
Reimplemented from edm::EDAnalyzer.
Definition at line 118 of file CandidateSummaryTable.cc.
References collections_, it, logName_, perJob_, self_, and totalEvents_.
00118 { 00119 using std::setw; using std::left; using std::right; using std::setprecision; 00120 if (perJob_) { 00121 std::ostringstream oss; 00122 oss << "Summary Table " << logName_ << " (" << self_ << ", events total " << totalEvents_ << ")\n"; 00123 for (std::vector<Record>::iterator it = collections_.begin(), ed = collections_.end(); it != ed; ++it) { 00124 oss << " " << setw(30) << left << it->src.encode() << right << 00125 " present " << setw(7) << it->present << " (" << setw(4) << setprecision(3) << (it->present*100.0/totalEvents_) << "%)" << 00126 " empty " << setw(7) << it->empty << " (" << setw(4) << setprecision(3) << (it->empty*100.0/totalEvents_) << "%)" << 00127 " min " << setw(7) << it->min << 00128 " max " << setw(7) << it->max << 00129 " total " << setw(7) << it->total << 00130 " avg " << setw(5) << setprecision(3) << (it->total/double(totalEvents_)) << "\n"; 00131 } 00132 oss << "\n"; 00133 edm::LogVerbatim(logName_) << oss.str(); 00134 } 00135 }
std::vector<Record> pat::CandidateSummaryTable::collections_ [private] |
Definition at line 53 of file CandidateSummaryTable.cc.
Referenced by analyze(), CandidateSummaryTable(), and endJob().
bool pat::CandidateSummaryTable::dumpItems_ [private] |
std::string pat::CandidateSummaryTable::logName_ [private] |
bool pat::CandidateSummaryTable::perEvent_ [private] |
bool pat::CandidateSummaryTable::perJob_ [private] |
std::string pat::CandidateSummaryTable::self_ [private] |
size_t pat::CandidateSummaryTable::totalEvents_ [private] |