CMS 3D CMS Logo

HLTrigReport Class Reference

This class is an EDAnalyzer implementing TrigReport (statistics printed to log file) for HL triggers. More...

#include <HLTrigger/HLTanalyzers/interface/HLTrigReport.h>

Inheritance diagram for HLTrigReport:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void endJob ()
 HLTrigReport (const edm::ParameterSet &)
 ~HLTrigReport ()

Private Attributes

std::vector< unsigned inthlAccept_
std::vector< unsigned inthlErrors_
std::vector< std::string > hlNames_
edm::InputTag hlTriggerResults_
std::vector< unsigned inthlWasRun_
bool init_
unsigned int nAccept_
unsigned int nErrors_
unsigned int nEvents_
unsigned int nWasRun_
edm::TriggerNames triggerNames_


Detailed Description

This class is an EDAnalyzer implementing TrigReport (statistics printed to log file) for HL triggers.

See header file for documentation.

Date
2007/06/19 11:47:50
Revision
1.2

Author:
Martin Grunewald
Date
2007/12/18 08:28:01
Revision
1.4

Author:
Martin Grunewald

Definition at line 29 of file HLTrigReport.h.


Constructor & Destructor Documentation

HLTrigReport::HLTrigReport ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 25 of file HLTrigReport.cc.

References edm::InputTag::encode(), hlTriggerResults_, and LogDebug.

00025                                                          :
00026   hlTriggerResults_ (iConfig.getParameter<edm::InputTag> ("HLTriggerResults")),
00027   triggerNames_(),
00028   nEvents_(0),
00029   nWasRun_(0),
00030   nAccept_(0),
00031   nErrors_(0),
00032   hlWasRun_(0),
00033   hlAccept_(0),
00034   hlErrors_(0),
00035   hlNames_(0),
00036   init_(false)
00037 {
00038   LogDebug("") << "HL TiggerResults: " + hlTriggerResults_.encode();
00039 }

HLTrigReport::~HLTrigReport (  ) 

Definition at line 41 of file HLTrigReport.cc.

00042 { }


Member Function Documentation

void HLTrigReport::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 50 of file HLTrigReport.cc.

References edm::InputTag::encode(), edm::Event::getByLabel(), hlAccept_, hlErrors_, hlNames_, hlTriggerResults_, hlWasRun_, i, edm::TriggerNames::init(), init_, LogDebug, n, nAccept_, nErrors_, nEvents_, nWasRun_, std, edm::TriggerNames::triggerNames(), and triggerNames_.

00051 {
00052   // accumulation of statistics event by event
00053 
00054   using namespace std;
00055   using namespace edm;
00056 
00057   nEvents_++;
00058 
00059   // get hold of TriggerResults
00060   Handle<TriggerResults> HLTR;
00061   iEvent.getByLabel(hlTriggerResults_,HLTR);
00062   if (HLTR.isValid()) {
00063     if (HLTR->wasrun()) nWasRun_++;
00064     const bool accept(HLTR->accept());
00065     LogDebug("") << "HL TriggerResults decision: " << accept;
00066     if (accept) ++nAccept_;
00067     if (HLTR->error() ) nErrors_++;
00068   } else {
00069     LogDebug("") << "HL TriggerResults with label ["+hlTriggerResults_.encode()+"] not found!";
00070     nErrors_++;
00071     return;
00072   }
00073 
00074   // initialisation (could be made dynamic)
00075   if (!init_) {
00076     init_=true;
00077     triggerNames_.init(*HLTR);
00078     hlNames_=triggerNames_.triggerNames();
00079     const unsigned int n(hlNames_.size());
00080     hlWasRun_.resize(n);
00081     hlAccept_.resize(n);
00082     hlErrors_.resize(n);
00083     for (unsigned int i=0; i!=n; ++i) {
00084       hlWasRun_[i]=0;
00085       hlAccept_[i]=0;
00086       hlErrors_[i]=0;
00087     }
00088   }
00089 
00090   // decision for each HL algorithm
00091   const unsigned int n(hlNames_.size());
00092   for (unsigned int i=0; i!=n; ++i) {
00093     if (HLTR->wasrun(i)) hlWasRun_[i]++;
00094     if (HLTR->accept(i)) hlAccept_[i]++;
00095     if (HLTR->error(i) ) hlErrors_[i]++;
00096   }
00097 
00098   return;
00099 
00100 }

void HLTrigReport::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file HLTrigReport.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), hlAccept_, hlErrors_, hlNames_, hlWasRun_, i, init_, n, nAccept_, nErrors_, nEvents_, nWasRun_, and std.

00104 {
00105   // final printout of accumulated statistics
00106 
00107   using namespace std;
00108   const unsigned int n(hlNames_.size());
00109 
00110     cout << dec << endl;
00111     cout << "HLT-Report " << "---------- Event  Summary ------------\n";
00112     cout << "HLT-Report"
00113          << " Events total = " << nEvents_
00114          << " wasrun = " << nWasRun_
00115          << " passed = " << nAccept_
00116          << " errors = " << nErrors_
00117          << "\n";
00118 
00119     cout << endl;
00120     cout << "HLT-Report " << "---------- HLTrig Summary ------------\n";
00121     cout << "HLT-Report "
00122          << right << setw(10) << "HLT  Bit#" << " "
00123          << right << setw(10) << "WasRun" << " "
00124          << right << setw(10) << "Passed" << " "
00125          << right << setw(10) << "Errors" << " "
00126          << "Name" << "\n";
00127 
00128   if (init_) {
00129     for (unsigned int i=0; i!=n; ++i) {
00130       cout << "HLT-Report "
00131            << right << setw(10) << i << " "
00132            << right << setw(10) << hlWasRun_[i] << " "
00133            << right << setw(10) << hlAccept_[i] << " "
00134            << right << setw(10) << hlErrors_[i] << " "
00135            << hlNames_[i] << "\n";
00136     }
00137   } else {
00138     cout << "HLT-Report - No HL TriggerResults found!" << endl;
00139   }
00140 
00141     cout << endl;
00142     cout << "HLT-Report end!" << endl;
00143     cout << endl;
00144 
00145     return;
00146 }


Member Data Documentation

std::vector<unsigned int> HLTrigReport::hlAccept_ [private]

Definition at line 50 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

std::vector<unsigned int> HLTrigReport::hlErrors_ [private]

Definition at line 51 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

std::vector<std::string> HLTrigReport::hlNames_ [private]

Definition at line 53 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

edm::InputTag HLTrigReport::hlTriggerResults_ [private]

Definition at line 40 of file HLTrigReport.h.

Referenced by analyze(), and HLTrigReport().

std::vector<unsigned int> HLTrigReport::hlWasRun_ [private]

Definition at line 49 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

bool HLTrigReport::init_ [private]

Definition at line 54 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

unsigned int HLTrigReport::nAccept_ [private]

Definition at line 46 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

unsigned int HLTrigReport::nErrors_ [private]

Definition at line 47 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

unsigned int HLTrigReport::nEvents_ [private]

Definition at line 43 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

unsigned int HLTrigReport::nWasRun_ [private]

Definition at line 45 of file HLTrigReport.h.

Referenced by analyze(), and endJob().

edm::TriggerNames HLTrigReport::triggerNames_ [private]

Definition at line 41 of file HLTrigReport.h.

Referenced by analyze().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:40 2009 for CMSSW by  doxygen 1.5.4