1 |
#ifndef HLTAnalyzer_h
|
2 |
#define HLTAnalyzer_h
|
3 |
|
4 |
// system include files
|
5 |
#include <memory>
|
6 |
#include <string>
|
7 |
#include <iostream>
|
8 |
|
9 |
// user include files
|
10 |
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
11 |
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
12 |
#include "FWCore/Framework/interface/Event.h"
|
13 |
#include "FWCore/Framework/interface/MakerMacros.h"
|
14 |
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
15 |
#include "FWCore/Framework/interface/ESHandle.h"
|
16 |
#include "FWCore/Framework/interface/TriggerNames.h"
|
17 |
|
18 |
#include "DataFormats/Common/interface/TriggerResults.h"
|
19 |
|
20 |
#include "UserCode/Morgan/interface/TRootRun.h"
|
21 |
#include "UserCode/Morgan/interface/TRootEvent.h"
|
22 |
|
23 |
#include <iomanip>
|
24 |
|
25 |
|
26 |
class HLTAnalyzer{
|
27 |
|
28 |
public:
|
29 |
|
30 |
HLTAnalyzer(edm::ParameterSet * iConfig) :
|
31 |
verbosity_(0)
|
32 |
,triggerResultsTag_(iConfig->getParameter<edm::InputTag> ("HLTAnalyzerTag"))
|
33 |
,triggerNames_()
|
34 |
,nEvents_(0)
|
35 |
,nWasRun_(0)
|
36 |
,nAccept_(0)
|
37 |
,nErrors_(0)
|
38 |
,hltWasRun_(0)
|
39 |
,hltAccept_(0)
|
40 |
,hltErrors_(0)
|
41 |
,hltNames_(0)
|
42 |
{;}
|
43 |
|
44 |
~HLTAnalyzer() {;}
|
45 |
|
46 |
void setVerbosity(int verbosity) {verbosity_ = verbosity; };
|
47 |
void init(const edm::Event& iEvent, TRootEvent* rootEvent);
|
48 |
void process(const edm::Event& iEvent, TRootEvent* rootEvent);
|
49 |
void printStats();
|
50 |
void copySummary(TRootRun* runInfos);
|
51 |
|
52 |
unsigned int nHLTPaths() const { return hltNames_.size(); }
|
53 |
|
54 |
unsigned int nEvents() const { return nEvents_; }
|
55 |
unsigned int nWasRun() const { return nWasRun_; }
|
56 |
unsigned int nAccept() const { return nAccept_; }
|
57 |
unsigned int nErrors() const { return nErrors_; }
|
58 |
|
59 |
std::vector<unsigned int> hltWasRun() const { return hltWasRun_; }
|
60 |
std::vector<unsigned int> hltAccept() const { return hltAccept_; }
|
61 |
std::vector<unsigned int> hltErrors() const { return hltErrors_; }
|
62 |
std::vector<std::string> hltNames() const { return hltNames_; }
|
63 |
|
64 |
unsigned int hltWasRun(unsigned ipath) const { return (hltWasRun_.size()>ipath ? hltWasRun_.at(ipath) : 0 ); }
|
65 |
unsigned int hltAccept(unsigned ipath) const { return (hltAccept_.size()>ipath ? hltAccept_.at(ipath) : 0 ); }
|
66 |
unsigned int hltErrors(unsigned ipath) const { return (hltErrors_.size()>ipath ? hltErrors_.at(ipath) : 0 ); }
|
67 |
std::string hltNames(unsigned ipath) const { return (hltNames_.size()>ipath ? hltNames_.at(ipath) : "noname" ); }
|
68 |
|
69 |
private:
|
70 |
|
71 |
int verbosity_;
|
72 |
|
73 |
edm::InputTag triggerResultsTag_; // Input tag for TriggerResults
|
74 |
edm::TriggerNames triggerNames_; // TriggerNames class
|
75 |
|
76 |
unsigned int nEvents_; // number of events processed
|
77 |
unsigned int nWasRun_; // # where at least one HLT was run
|
78 |
unsigned int nAccept_; // # of accepted events
|
79 |
unsigned int nErrors_; // # where at least one HLT had error
|
80 |
|
81 |
std::vector<unsigned int> hltWasRun_; // # where HLT[i] was run
|
82 |
std::vector<unsigned int> hltAccept_; // # of events accepted by HLT[i]
|
83 |
std::vector<unsigned int> hltErrors_; // # of events with error in HLT[i]
|
84 |
std::vector<std::string> hltNames_; // name of each HLT algorithm
|
85 |
|
86 |
};
|
87 |
|
88 |
#endif
|