CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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

Author
Martin Grunewald

See header file for documentation

Author
Martin Grunewald

Definition at line 27 of file HLTEventAnalyzerAOD.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file HLTEventAnalyzerAOD.cc.

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

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

Definition at line 38 of file HLTEventAnalyzerAOD.cc.

39 {
40 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 93 of file HLTEventAnalyzerAOD.cc.

References analyzeTrigger(), gather_cfg::cout, edm::Event::getByToken(), hltConfig_, i, edm::HandleBase::isValid(), n, HLTConfigProvider::size(), triggerEventHandle_, triggerEventToken_, HLTConfigProvider::triggerName(), triggerName_, triggerResultsHandle_, and triggerResultsToken_.

94 {
95  using namespace std;
96  using namespace edm;
97 
98  cout << endl;
99 
100  // get event products
103  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
104  return;
105  }
107  if (!triggerEventHandle_.isValid()) {
108  cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
109  return;
110  }
111  // sanity check
112  assert(triggerResultsHandle_->size()==hltConfig_.size());
113 
114  // analyze this event for the triggers requested
115  if (triggerName_=="@") {
116  const unsigned int n(hltConfig_.size());
117  for (unsigned int i=0; i!=n; ++i) {
118  analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i));
119  }
120  } else {
121  analyzeTrigger(iEvent,iSetup,triggerName_);
122  }
123 
124  return;
125 
126 }
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)
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const std::string & triggerName(unsigned int triggerIndex) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
bool isValid() const
Definition: HandleBase.h:76
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 128 of file HLTEventAnalyzerAOD.cc.

References gather_cfg::cout, trigger::TriggerObject::eta(), hltConfig_, i, trigger::TriggerObject::id(), j, m, trigger::TriggerObject::mass(), bookConverter::max, python.rootplot.argparse::message, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), n, trigger::TriggerObject::phi(), makeHLTPrescaleTable::prescales, HLTConfigProvider::prescaleValues(), HLTConfigProvider::prescaleValuesInDetail(), 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().

128  {
129 
130  using namespace std;
131  using namespace edm;
132  using namespace reco;
133  using namespace trigger;
134 
135  cout << endl;
136 
137  const unsigned int n(hltConfig_.size());
138  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName));
139  assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName));
140 
141  // abort on invalid trigger name
142  if (triggerIndex>=n) {
143  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
144  << triggerName << " - not found!" << endl;
145  return;
146  }
147 
148  const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerName));
149  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
150  << triggerName << " [" << triggerIndex << "] "
151  << "prescales L1T,HLT: " << prescales.first << "," << prescales.second
152  << endl;
153  const std::pair<std::vector<std::pair<std::string,int> >,int> prescalesInDetail(hltConfig_.prescaleValuesInDetail(iEvent,iSetup,triggerName));
154  std::ostringstream message;
155  for (unsigned int i=0; i<prescalesInDetail.first.size(); ++i) {
156  message << " " << i << ":" << prescalesInDetail.first[i].first << "/" << prescalesInDetail.first[i].second;
157  }
158  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
159  << triggerName << " [" << triggerIndex << "] "
160  << endl
161  << "prescales L1T: " << prescalesInDetail.first.size() << message.str()
162  << endl
163  << "prescale HLT: " << prescalesInDetail.second
164  << endl;
165 
166  // modules on this trigger path
167  const unsigned int m(hltConfig_.size(triggerIndex));
168  const vector<string>& moduleLabels(hltConfig_.moduleLabels(triggerIndex));
169 
170  // Results from TriggerResults product
171  cout << " Trigger path status:"
172  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
173  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
174  << " Error =" << triggerResultsHandle_->error(triggerIndex)
175  << endl;
176  const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex));
177  cout << " Last active module - label/type: "
178  << moduleLabels[moduleIndex] << "/" << hltConfig_.moduleType(moduleLabels[moduleIndex])
179  << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]"
180  << endl;
181  assert (moduleIndex<m);
182 
183  // Results from TriggerEvent product - Attention: must look only for
184  // modules actually run in this path for this event!
185  for (unsigned int j=0; j<=moduleIndex; ++j) {
186  const string& moduleLabel(moduleLabels[j]);
187  const string moduleType(hltConfig_.moduleType(moduleLabel));
188  // check whether the module is packed up in TriggerEvent product
189  const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
190  if (filterIndex<triggerEventHandle_->sizeFilters()) {
191  cout << " 'L3' filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
192  const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex));
193  const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex));
194  const size_type nI(VIDS.size());
195  const size_type nK(KEYS.size());
196  assert(nI==nK);
197  const size_type n(max(nI,nK));
198  cout << " " << n << " accepted 'L3' objects found: " << endl;
199  const TriggerObjectCollection& TOC(triggerEventHandle_->getObjects());
200  for (size_type i=0; i!=n; ++i) {
201  const TriggerObject& TO(TOC[KEYS[i]]);
202  cout << " " << i << " " << VIDS[i] << "/" << KEYS[i] << ": "
203  << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass()
204  << endl;
205  }
206  }
207  }
208 
209  return;
210 }
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:199
const std::string moduleType(const std::string &module) const
C++ class name of module.
std::pair< std::vector< std::pair< std::string, int > >, int > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger) const
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:22
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
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:81
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 56 of file HLTEventAnalyzerAOD.cc.

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

57 {
58  using namespace std;
59  using namespace edm;
60 
61  bool changed(true);
62  if (hltConfig_.init(iRun,iSetup,processName_,changed)) {
63  if (changed) {
64  // check if trigger name in (new) config
65  if (triggerName_!="@") { // "@" means: analyze all triggers in config
66  const unsigned int n(hltConfig_.size());
67  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName_));
68  if (triggerIndex>=n) {
69  cout << "HLTEventAnalyzerAOD::analyze:"
70  << " TriggerName " << triggerName_
71  << " not available in (new) config!" << endl;
72  cout << "Available TriggerNames are: " << endl;
73  hltConfig_.dump("Triggers");
74  }
75  }
76  hltConfig_.dump("ProcessName");
77  hltConfig_.dump("GlobalTag");
78  hltConfig_.dump("TableName");
79  hltConfig_.dump("Streams");
80  hltConfig_.dump("Datasets");
81  hltConfig_.dump("PrescaleTable");
82  hltConfig_.dump("ProcessPSet");
83  }
84  } else {
85  cout << "HLTEventAnalyzerAOD::analyze:"
86  << " config extraction failure with process name "
87  << processName_ << endl;
88  }
89 }
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
void HLTEventAnalyzerAOD::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 46 of file HLTEventAnalyzerAOD.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
48  desc.add<std::string>("processName","HLT");
49  desc.add<std::string>("triggerName","@");
50  desc.add<edm::InputTag>("triggerResults",edm::InputTag("TriggerResults","","HLT"));
51  desc.add<edm::InputTag>("triggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT"));
52  descriptions.add("hltEventAnalyzerAOD", desc);
53 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

HLTConfigProvider HLTEventAnalyzerAOD::hltConfig_
private

Definition at line 51 of file HLTEventAnalyzerAOD.h.

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

std::string HLTEventAnalyzerAOD::processName_
private

module config parameters

Definition at line 41 of file HLTEventAnalyzerAOD.h.

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

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

Definition at line 50 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

edm::InputTag HLTEventAnalyzerAOD::triggerEventTag_
private

Definition at line 45 of file HLTEventAnalyzerAOD.h.

Referenced by HLTEventAnalyzerAOD().

edm::EDGetTokenT<trigger::TriggerEvent> HLTEventAnalyzerAOD::triggerEventToken_
private

Definition at line 46 of file HLTEventAnalyzerAOD.h.

Referenced by analyze().

std::string HLTEventAnalyzerAOD::triggerName_
private

Definition at line 42 of file HLTEventAnalyzerAOD.h.

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

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

additional class data memebers

Definition at line 49 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

edm::InputTag HLTEventAnalyzerAOD::triggerResultsTag_
private

Definition at line 43 of file HLTEventAnalyzerAOD.h.

Referenced by HLTEventAnalyzerAOD().

edm::EDGetTokenT<edm::TriggerResults> HLTEventAnalyzerAOD::triggerResultsToken_
private

Definition at line 44 of file HLTEventAnalyzerAOD.h.

Referenced by analyze().