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 edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

Date:
2010/07/14 15:30:06
Revision:
1.4
Author
Martin Grunewald

See header file for documentation

Date:
2012/03/21 13:05:25
Revision:
1.11
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:164
std::string processName_
module config parameters
edm::InputTag triggerResultsTag_
tuple cout
Definition: gather_cfg.py:121
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 82 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_.

83 {
84  using namespace std;
85  using namespace edm;
86 
87  cout << endl;
88 
89  // get event products
92  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
93  return;
94  }
97  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
98  return;
99  }
100  // sanity check
101  assert(triggerResultsHandle_->size()==hltConfig_.size());
102 
103  // analyze this event for the triggers requested
104  if (triggerName_=="@") {
105  const unsigned int n(hltConfig_.size());
106  for (unsigned int i=0; i!=n; ++i) {
107  analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i));
108  }
109  } else {
110  analyzeTrigger(iEvent,iSetup,triggerName_);
111  }
112 
113  return;
114 
115 }
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:361
edm::Handle< edm::TriggerResults > triggerResultsHandle_
additional class data memebers
HLTConfigProvider hltConfig_
tuple cout
Definition: gather_cfg.py:121
void HLTEventAnalyzerAOD::analyzeTrigger ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  triggerName 
)
virtual

Definition at line 117 of file HLTEventAnalyzerAOD.cc.

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

Referenced by analyze().

117  {
118 
119  using namespace std;
120  using namespace edm;
121  using namespace reco;
122  using namespace trigger;
123 
124  cout << endl;
125 
126  const unsigned int n(hltConfig_.size());
127  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName));
128  assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName));
129 
130  // abort on invalid trigger name
131  if (triggerIndex>=n) {
132  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
133  << triggerName << " - not found!" << endl;
134  return;
135  }
136 
137  const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerName));
138  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
139  << triggerName << " [" << triggerIndex << "] "
140  << "prescales L1T,HLT: " << prescales.first << "," << prescales.second
141  << endl;
142 
143  // modules on this trigger path
144  const unsigned int m(hltConfig_.size(triggerIndex));
145  const vector<string>& moduleLabels(hltConfig_.moduleLabels(triggerIndex));
146 
147  // Results from TriggerResults product
148  cout << " Trigger path status:"
149  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
150  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
151  << " Error =" << triggerResultsHandle_->error(triggerIndex)
152  << endl;
153  const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex));
154  cout << " Last active module - label/type: "
155  << moduleLabels[moduleIndex] << "/" << hltConfig_.moduleType(moduleLabels[moduleIndex])
156  << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]"
157  << endl;
158  assert (moduleIndex<m);
159 
160  // Results from TriggerEvent product - Attention: must look only for
161  // modules actually run in this path for this event!
162  for (unsigned int j=0; j<=moduleIndex; ++j) {
163  const string& moduleLabel(moduleLabels[j]);
164  const string moduleType(hltConfig_.moduleType(moduleLabel));
165  // check whether the module is packed up in TriggerEvent product
166  const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
167  if (filterIndex<triggerEventHandle_->sizeFilters()) {
168  cout << " 'L3' filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
169  const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex));
170  const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex));
171  const size_type nI(VIDS.size());
172  const size_type nK(KEYS.size());
173  assert(nI==nK);
174  const size_type n(max(nI,nK));
175  cout << " " << n << " accepted 'L3' objects found: " << endl;
176  const TriggerObjectCollection& TOC(triggerEventHandle_->getObjects());
177  for (size_type i=0; i!=n; ++i) {
178  const TriggerObject& TO(TOC[KEYS[i]]);
179  cout << " " << i << " " << VIDS[i] << "/" << KEYS[i] << ": "
180  << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass()
181  << endl;
182  }
183  }
184  }
185 
186  return;
187 }
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:207
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:121
std::vector< int > Vids
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("ProcessName");
66  hltConfig_.dump("GlobalTag");
67  hltConfig_.dump("TableName");
68  hltConfig_.dump("Streams");
69  hltConfig_.dump("Datasets");
70  hltConfig_.dump("PrescaleTable");
71  hltConfig_.dump("ProcessPSet");
72  }
73  } else {
74  cout << "HLTEventAnalyzerAOD::analyze:"
75  << " config extraction failure with process name "
76  << processName_ << endl;
77  }
78 }
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)
d&#39;tor
HLTConfigProvider hltConfig_
tuple cout
Definition: gather_cfg.py:121

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().