CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerSummaryAnalyzerAOD.cc
Go to the documentation of this file.
1 
12 
13 //
14 // constructors and destructor
15 //
17  inputTag_(ps.getParameter<edm::InputTag>("inputTag")),
18  inputToken_(consumes<trigger::TriggerEvent>(inputTag_))
19 { }
20 
22 {
23 }
24 
25 //
26 // member functions
27 //
28 
31  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltTriggerSummaryAOD"));
32  descriptions.add("triggerSummaryAnalyzerAOD", desc);
33 }
34 
35 // ------------ method called to produce the data ------------
36 void
38 {
39  using namespace std;
40  using namespace edm;
41  using namespace reco;
42  using namespace trigger;
43 
44 
45  cout << endl;
46  cout << "TriggerSummaryAnalyzerAOD: content of TriggerEvent: " << inputTag_.encode() << endl;
47 
50  if (handle.isValid()) {
51  cout << "Used Processname: " << handle->usedProcessName() << endl;
52  const size_type nC(handle->sizeCollections());
53  cout << "Number of packed Collections: " << nC << endl;
54  cout << "The Collections: #, tag, 1-past-end index" << endl;
55  for (size_type iC=0; iC!=nC; ++iC) {
56  cout << iC << " "
57  << handle->collectionTag(iC).encode() << " "
58  << handle->collectionKey(iC) << endl;
59  }
60  const size_type nO(handle->sizeObjects());
61  cout << "Number of TriggerObjects: " << nO << endl;
62  cout << "The TriggerObjects: #, id, pt, eta, phi, mass" << endl;
63  const TriggerObjectCollection& TOC(handle->getObjects());
64  for (size_type iO=0; iO!=nO; ++iO) {
65  const TriggerObject& TO(TOC[iO]);
66  cout << iO << " " << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass() << endl;
67  }
68  const size_type nF(handle->sizeFilters());
69  cout << "Number of TriggerFilters: " << nF << endl;
70  cout << "The Filters: #, tag, #ids/#keys, the id/key pairs" << endl;
71  for (size_type iF=0; iF!=nF; ++iF) {
72  const Vids& VIDS (handle->filterIds(iF));
73  const Keys& KEYS(handle->filterKeys(iF));
74  const size_type nI(VIDS.size());
75  const size_type nK(KEYS.size());
76  cout << iF << " " << handle->filterTag(iF).encode()
77  << " " << nI << "/" << nK
78  << " the pairs: ";
79  const size_type n(max(nI,nK));
80  for (size_type i=0; i!=n; ++i) {
81  cout << " " << VIDS[i] << "/" << KEYS[i];
82  }
83  cout << endl;
84  assert (nI==nK);
85  }
86  } else {
87  cout << "Handle invalid! Check InputTag provided." << endl;
88  }
89  cout << endl;
90 
91  return;
92 }
int i
Definition: DBlmapReader.cc:9
TriggerSummaryAnalyzerAOD(const edm::ParameterSet &)
int id() const
getters
Definition: TriggerObject.h:55
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
float phi() const
Definition: TriggerObject.h:58
float eta() const
Definition: TriggerObject.h:57
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:164
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
int iEvent
Definition: GenABIO.cc:230
const T & max(const T &a, const T &b)
tuple handle
Definition: patZpeak.py:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::InputTag inputTag_
InputTag of TriggerEvent to analyze.
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< size_type > Keys
void add(std::string const &label, ParameterSetDescription const &psetDescription)
tuple cout
Definition: gather_cfg.py:121
float mass() const
Definition: TriggerObject.h:59
edm::EDGetTokenT< trigger::TriggerEvent > inputToken_
std::vector< int > Vids