CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HLTEventAnalyzerAOD Class Reference

#include <HLTEventAnalyzerAOD.h>

Inheritance diagram for HLTEventAnalyzerAOD:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void analyzeTrigger (const edm::Event &, const edm::EventSetup &, const std::string &triggerName)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 HLTEventAnalyzerAOD (const edm::ParameterSet &)
 
 ~HLTEventAnalyzerAOD ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

HLTConfigProvider hltConfig_
 
std::string processName_
 module config parameters More...
 
edm::Handle
< trigger::TriggerEvent
triggerEventHandle_
 
edm::InputTag triggerEventTag_
 
std::string triggerName_
 
edm::Handle< edm::TriggerResultstriggerResultsHandle_
 additional class data memebers More...
 
edm::InputTag triggerResultsTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

This class is an EDAnalyzer analyzing the combined HLT information for AOD

Date:
2010/02/19 14:26:53
Revision:
1.3
Author
Martin Grunewald

See header file for documentation

Date:
2010/03/14 08:05:03
Revision:
1.8
Author
Martin Grunewald

Definition at line 26 of file HLTEventAnalyzerAOD.h.

Constructor & Destructor Documentation

HLTEventAnalyzerAOD::HLTEventAnalyzerAOD ( const edm::ParameterSet ps)
explicit

Definition at line 20 of file HLTEventAnalyzerAOD.cc.

References gather_cfg::cout, edm::InputTag::encode(), processName_, triggerEventTag_, triggerName_, and triggerResultsTag_.

20  :
21  processName_(ps.getParameter<std::string>("processName")),
22  triggerName_(ps.getParameter<std::string>("triggerName")),
23  triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
24  triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent"))
25 {
26  using namespace std;
27  using namespace edm;
28 
29  cout << "HLTEventAnalyzerAOD configuration: " << endl
30  << " ProcessName = " << processName_ << endl
31  << " TriggerName = " << triggerName_ << endl
32  << " TriggerResultsTag = " << triggerResultsTag_.encode() << endl
33  << " TriggerEventTag = " << triggerEventTag_.encode() << endl;
34 
35 }
T getParameter(std::string const &) const
edm::InputTag triggerEventTag_
std::string encode() const
Definition: InputTag.cc:72
std::string processName_
module config parameters
edm::InputTag triggerResultsTag_
tuple cout
Definition: gather_cfg.py:41
HLTEventAnalyzerAOD::~HLTEventAnalyzerAOD ( )

Definition at line 37 of file HLTEventAnalyzerAOD.cc.

38 {
39 }

Member Function Documentation

void HLTEventAnalyzerAOD::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 79 of file HLTEventAnalyzerAOD.cc.

References analyzeTrigger(), gather_cfg::cout, edm::Event::getByLabel(), hltConfig_, i, edm::HandleBase::isValid(), n, HLTConfigProvider::size(), triggerEventHandle_, triggerEventTag_, HLTConfigProvider::triggerName(), triggerName_, triggerResultsHandle_, and triggerResultsTag_.

80 {
81  using namespace std;
82  using namespace edm;
83 
84  cout << endl;
85 
86  // get event products
89  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
90  return;
91  }
94  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
95  return;
96  }
97  // sanity check
98  assert(triggerResultsHandle_->size()==hltConfig_.size());
99 
100  // analyze this event for the triggers requested
101  if (triggerName_=="@") {
102  const unsigned int n(hltConfig_.size());
103  for (unsigned int i=0; i!=n; ++i) {
104  analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i));
105  }
106  } else {
107  analyzeTrigger(iEvent,iSetup,triggerName_);
108  }
109 
110  return;
111 
112 }
unsigned int size() const
number of trigger paths in trigger table
int i
Definition: DBlmapReader.cc:9
virtual void analyzeTrigger(const edm::Event &, const edm::EventSetup &, const std::string &triggerName)
const std::string & triggerName(unsigned int triggerIndex) const
edm::InputTag triggerEventTag_
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
edm::InputTag triggerResultsTag_
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
edm::Handle< edm::TriggerResults > triggerResultsHandle_
additional class data memebers
HLTConfigProvider hltConfig_
tuple cout
Definition: gather_cfg.py:41
void HLTEventAnalyzerAOD::analyzeTrigger ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  triggerName 
)
virtual

Definition at line 114 of file HLTEventAnalyzerAOD.cc.

References gather_cfg::cout, trigger::TriggerObject::eta(), hltConfig_, i, trigger::TriggerObject::id(), j, m, trigger::TriggerObject::mass(), max(), moduleLabel(), HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), n, trigger::TriggerObject::phi(), makeHLTPrescaleTable::prescales, HLTConfigProvider::prescaleValues(), processName_, trigger::TriggerObject::pt(), dt_dqm_sourceclient_common_cff::reco, HLTConfigProvider::size(), triggerEventHandle_, edm::TriggerNames::triggerIndex(), HLTConfigProvider::triggerIndex(), edm::Event::triggerNames(), and triggerResultsHandle_.

Referenced by analyze().

114  {
115 
116  using namespace std;
117  using namespace edm;
118  using namespace reco;
119  using namespace trigger;
120 
121  cout << endl;
122 
123  const unsigned int n(hltConfig_.size());
124  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName));
125  assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName));
126 
127  // abort on invalid trigger name
128  if (triggerIndex>=n) {
129  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
130  << triggerName << " - not found!" << endl;
131  return;
132  }
133 
134  const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerName));
135  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
136  << triggerName << " [" << triggerIndex << "] "
137  << "prescales L1T,HLT: " << prescales.first << "," << prescales.second
138  << endl;
139 
140  // modules on this trigger path
141  const unsigned int m(hltConfig_.size(triggerIndex));
142  const vector<string>& moduleLabels(hltConfig_.moduleLabels(triggerIndex));
143 
144  // Results from TriggerResults product
145  cout << " Trigger path status:"
146  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
147  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
148  << " Error =" << triggerResultsHandle_->error(triggerIndex)
149  << endl;
150  const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex));
151  cout << " Last active module - label/type: "
152  << moduleLabels[moduleIndex] << "/" << hltConfig_.moduleType(moduleLabels[moduleIndex])
153  << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]"
154  << endl;
155  assert (moduleIndex<m);
156 
157  // Results from TriggerEvent product - Attention: must look only for
158  // modules actually run in this path for this event!
159  for (unsigned int j=0; j<=moduleIndex; ++j) {
160  const string& moduleLabel(moduleLabels[j]);
161  const string moduleType(hltConfig_.moduleType(moduleLabel));
162  // check whether the module is packed up in TriggerEvent product
163  const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
164  if (filterIndex<triggerEventHandle_->sizeFilters()) {
165  cout << " 'L3' filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
166  const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex));
167  const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex));
168  const size_type nI(VIDS.size());
169  const size_type nK(KEYS.size());
170  assert(nI==nK);
171  const size_type n(max(nI,nK));
172  cout << " " << n << " accepted 'L3' objects found: " << endl;
173  const TriggerObjectCollection& TOC(triggerEventHandle_->getObjects());
174  for (size_type i=0; i!=n; ++i) {
175  const TriggerObject& TO(TOC[KEYS[i]]);
176  cout << " " << i << " " << VIDS[i] << "/" << KEYS[i] << ": "
177  << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass()
178  << endl;
179  }
180  }
181  }
182 
183  return;
184 }
unsigned int size() const
number of trigger paths in trigger table
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
const std::string moduleType(const std::string &module) const
C++ class name of module.
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
uint16_t size_type
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
const T & max(const T &a, const T &b)
std::string processName_
module config parameters
int j
Definition: DBlmapReader.cc:9
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
edm::Handle< edm::TriggerResults > triggerResultsHandle_
additional class data memebers
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
std::vector< size_type > Keys
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger) const
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
HLTConfigProvider hltConfig_
tuple cout
Definition: gather_cfg.py:41
std::vector< int > Vids
const std::string * moduleLabel() const
Definition: HLTadd.h:40
void HLTEventAnalyzerAOD::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file HLTEventAnalyzerAOD.cc.

References gather_cfg::cout, HLTConfigProvider::dump(), hltConfig_, HLTConfigProvider::init(), n, processName_, HLTConfigProvider::size(), HLTConfigProvider::triggerIndex(), and triggerName_.

46 {
47  using namespace std;
48  using namespace edm;
49 
50  bool changed(true);
51  if (hltConfig_.init(iRun,iSetup,processName_,changed)) {
52  if (changed) {
53  // check if trigger name in (new) config
54  if (triggerName_!="@") { // "@" means: analyze all triggers in config
55  const unsigned int n(hltConfig_.size());
56  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName_));
57  if (triggerIndex>=n) {
58  cout << "HLTEventAnalyzerAOD::analyze:"
59  << " TriggerName " << triggerName_
60  << " not available in (new) config!" << endl;
61  cout << "Available TriggerNames are: " << endl;
62  hltConfig_.dump("Triggers");
63  }
64  }
65  hltConfig_.dump("Streams");
66  hltConfig_.dump("Datasets");
67  hltConfig_.dump("PrescaleTable");
68  hltConfig_.dump("ProcessPSet");
69  }
70  } else {
71  cout << "HLTEventAnalyzerAOD::analyze:"
72  << " config extraction failure with process name "
73  << processName_ << endl;
74  }
75 }
unsigned int size() const
number of trigger paths in trigger table
void dump(const std::string &what) const
Dumping config info to cout.
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::string processName_
module config parameters
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
HLTConfigProvider hltConfig_
tuple cout
Definition: gather_cfg.py:41

Member Data Documentation

HLTConfigProvider HLTEventAnalyzerAOD::hltConfig_
private

Definition at line 47 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), analyzeTrigger(), and beginRun().

std::string HLTEventAnalyzerAOD::processName_
private

module config parameters

Definition at line 39 of file HLTEventAnalyzerAOD.h.

Referenced by analyzeTrigger(), beginRun(), and HLTEventAnalyzerAOD().

edm::Handle<trigger::TriggerEvent> HLTEventAnalyzerAOD::triggerEventHandle_
private

Definition at line 46 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

edm::InputTag HLTEventAnalyzerAOD::triggerEventTag_
private

Definition at line 42 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and HLTEventAnalyzerAOD().

std::string HLTEventAnalyzerAOD::triggerName_
private

Definition at line 40 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), beginRun(), and HLTEventAnalyzerAOD().

edm::Handle<edm::TriggerResults> HLTEventAnalyzerAOD::triggerResultsHandle_
private

additional class data memebers

Definition at line 45 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

edm::InputTag HLTEventAnalyzerAOD::triggerResultsTag_
private

Definition at line 41 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and HLTEventAnalyzerAOD().