CMS 3D CMS Logo

TriggerSummaryAnalyzerAOD.cc
Go to the documentation of this file.
1 
13 
14 //
15 // constructors and destructor
16 //
18  inputTag_(ps.getParameter<edm::InputTag>("inputTag")),
19  inputToken_(consumes<trigger::TriggerEvent>(inputTag_))
20 { }
21 
23 
24 //
25 // member functions
26 //
27 
30  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltTriggerSummaryAOD"));
31  descriptions.add("triggerSummaryAnalyzerAOD", desc);
32 }
33 
34 // ------------ method called to produce the data ------------
35 void
37 {
38  using namespace std;
39  using namespace edm;
40  using namespace reco;
41  using namespace trigger;
42 
43 
44  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
45  LogVerbatim("TriggerSummaryAnalyzerAOD") << "TriggerSummaryAnalyzerAOD: content of TriggerEvent: " << inputTag_.encode() << endl;
46 
48  iEvent.getByToken(inputToken_,handle);
49  if (handle.isValid()) {
50  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Used Processname: " << handle->usedProcessName() << endl;
51  const size_type nC(handle->sizeCollections());
52  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of packed Collections: " << nC << endl;
53  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The Collections: #, tag, 1-past-end index" << endl;
54  for (size_type iC=0; iC!=nC; ++iC) {
55  LogVerbatim("TriggerSummaryAnalyzerAOD") << iC << " "
56  << handle->collectionTag(iC).encode() << " "
57  << handle->collectionKey(iC) << endl;
58  }
59  const size_type nO(handle->sizeObjects());
60  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of TriggerObjects: " << nO << endl;
61  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The TriggerObjects: #, id, pt, eta, phi, mass" << endl;
62  const TriggerObjectCollection& TOC(handle->getObjects());
63  for (size_type iO=0; iO!=nO; ++iO) {
64  const TriggerObject& TO(TOC[iO]);
65  LogVerbatim("TriggerSummaryAnalyzerAOD") << iO << " " << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass() << endl;
66  }
67  const size_type nF(handle->sizeFilters());
68  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Number of TriggerFilters: " << nF << endl;
69  LogVerbatim("TriggerSummaryAnalyzerAOD") << "The Filters: #, tag, #ids/#keys, the id/key pairs" << endl;
70  for (size_type iF=0; iF!=nF; ++iF) {
71  const Vids& VIDS (handle->filterIds(iF));
72  const Keys& KEYS(handle->filterKeys(iF));
73  const size_type nI(VIDS.size());
74  const size_type nK(KEYS.size());
75  LogVerbatim("TriggerSummaryAnalyzerAOD") << iF << " " << handle->filterTag(iF).encode()
76  << " " << nI << "/" << nK
77  << " the pairs: ";
78  const size_type n(max(nI,nK));
79  for (size_type i=0; i!=n; ++i) {
80  LogVerbatim("TriggerSummaryAnalyzerAOD") << " " << VIDS[i] << "/" << KEYS[i];
81  }
82  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
83  assert (nI==nK);
84  }
85  } else {
86  LogVerbatim("TriggerSummaryAnalyzerAOD") << "Handle invalid! Check InputTag provided." << endl;
87  }
88  LogVerbatim("TriggerSummaryAnalyzerAOD") << endl;
89 
90  return;
91 }
TriggerSummaryAnalyzerAOD(const edm::ParameterSet &)
int id() const
getters
Definition: TriggerObject.h:55
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
trigger::size_type collectionKey(trigger::size_type index) const
Definition: TriggerEvent.h:102
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
float phi() const
Definition: TriggerObject.h:58
const edm::EDGetTokenT< trigger::TriggerEvent > inputToken_
virtual ~TriggerSummaryAnalyzerAOD()
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
float eta() const
Definition: TriggerObject.h:57
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:165
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:110
int iEvent
Definition: GenABIO.cc:230
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
const edm::InputTag inputTag_
InputTag of TriggerEvent to analyze.
const std::string & usedProcessName() const
getters
Definition: TriggerEvent.h:95
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
const edm::InputTag collectionTag(trigger::size_type index) const
Definition: TriggerEvent.h:100
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:134
std::vector< size_type > Keys
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:133
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
HLT enums.
float mass() const
Definition: TriggerObject.h:59
std::vector< int > Vids