CMS 3D CMS Logo

TriggerSummaryAnalyzerAOD.cc
Go to the documentation of this file.
1 
17 
18 //
19 // class declaration
20 //
22 public:
24 
25  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
26  void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override;
27 
28 private:
32 };
33 
34 //
35 // constructors and destructor
36 //
38  : inputTag_(ps.getParameter<edm::InputTag>("inputTag")), inputToken_(consumes<trigger::TriggerEvent>(inputTag_)) {}
39 
40 //
41 // member functions
42 //
43 
46  desc.add<edm::InputTag>("inputTag", edm::InputTag("hltTriggerSummaryAOD"));
47  descriptions.add("triggerSummaryAnalyzerAOD", desc);
48 }
49 
50 // ------------ method called to produce the data ------------
52  using namespace std;
53  using namespace edm;
54  using namespace reco;
55  using namespace trigger;
56 
57  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
58  LogVerbatim("TriggerSummaryAnalyzerAOD")
59  << "TriggerSummaryAnalyzerAOD: content of TriggerEvent: " << inputTag_.encode() << endl;
60 
62  iEvent.getByToken(inputToken_, handle);
63  if (handle.isValid()) {
64  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Used Processname: " << handle->usedProcessName() << endl;
65  const size_type nC(handle->sizeCollections());
66  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of packed Collections: " << nC << endl;
67  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The Collections: #, tag, 1-past-end index" << endl;
68  for (size_type iC = 0; iC != nC; ++iC) {
69  LogVerbatim("TriggerSummaryAnalyzerAOD")
70  << iC << " " << handle->collectionTag(iC).encode() << " " << handle->collectionKey(iC) << endl;
71  }
72  const size_type nO(handle->sizeObjects());
73  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of TriggerObjects: " << nO << endl;
74  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The TriggerObjects: #, id, pt, eta, phi, mass" << endl;
75  const TriggerObjectCollection& TOC(handle->getObjects());
76  for (size_type iO = 0; iO != nO; ++iO) {
77  const TriggerObject& TO(TOC[iO]);
78  LogVerbatim("TriggerSummaryAnalyzerAOD")
79  << iO << " " << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass() << endl;
80  }
81  const size_type nF(handle->sizeFilters());
82  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of TriggerFilters: " << nF << endl;
83  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The Filters: #, tag, #ids/#keys, the id/key pairs" << endl;
84  for (size_type iF = 0; iF != nF; ++iF) {
85  const Vids& VIDS(handle->filterIds(iF));
86  const Keys& KEYS(handle->filterKeys(iF));
87  const size_type nI(VIDS.size());
88  const size_type nK(KEYS.size());
89  LogVerbatim("TriggerSummaryAnalyzerAOD")
90  << iF << " " << handle->filterTag(iF).encode() << " " << nI << "/" << nK << " the pairs: ";
91  const size_type n(max(nI, nK));
92  for (size_type i = 0; i != n; ++i) {
93  LogVerbatim("TriggerSummaryAnalyzerAOD") << " " << VIDS[i] << "/" << KEYS[i];
94  }
95  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
96  assert(nI == nK);
97  }
98  } else {
99  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Handle invalid! Check InputTag provided." << endl;
100  }
101  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
102 
103  return;
104 }
105 
Log< level::Info, true > LogVerbatim
TriggerSummaryAnalyzerAOD(const edm::ParameterSet &)
void analyze(edm::StreamID, const edm::Event &, const edm::EventSetup &) const override
std::string encode() const
Definition: InputTag.cc:159
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< trigger::TriggerEvent > inputToken_
assert(be >=bs)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint16_t size_type
int iEvent
Definition: GenABIO.cc:224
const edm::InputTag inputTag_
InputTag of TriggerEvent to analyze.
int id() const
getters
Definition: TriggerObject.h:51
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
std::vector< size_type > Keys
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
std::vector< int > Vids