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::stream::EDAnalyzer<  > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void analyzeTrigger (const edm::Event &, const edm::EventSetup &, const std::string &triggerName)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
 HLTEventAnalyzerAOD (const edm::ParameterSet &)
 
virtual ~HLTEventAnalyzerAOD ()
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 20 of file HLTEventAnalyzerAOD.cc.

References 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  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
25  triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent")),
26  triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_))
27 {
28  using namespace std;
29  using namespace edm;
30 
31  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD configuration: " << endl
32  << " ProcessName = " << processName_ << endl
33  << " TriggerName = " << triggerName_ << endl
34  << " TriggerResultsTag = " << triggerResultsTag_.encode() << endl
35  << " TriggerEventTag = " << triggerEventTag_.encode() << endl;
36 
37 }
T getParameter(std::string const &) const
const edm::InputTag triggerResultsTag_
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const std::string triggerName_
const std::string processName_
module config parameters
std::string encode() const
Definition: InputTag.cc:164
const edm::InputTag triggerEventTag_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
HLTEventAnalyzerAOD::~HLTEventAnalyzerAOD ( )
virtual

Definition at line 39 of file HLTEventAnalyzerAOD.cc.

40 {
41 }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 97 of file HLTEventAnalyzerAOD.cc.

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

98 {
99  using namespace std;
100  using namespace edm;
101 
102  LogVerbatim("HLTEventAnalyzerAOD") << endl;
103 
104  // get event products
107  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
108  return;
109  }
111  if (!triggerEventHandle_.isValid()) {
112  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
113  return;
114  }
115  // sanity check
117 
118  // analyze this event for the triggers requested
119  if (triggerName_=="@") {
120  const unsigned int n(hltConfig_.size());
121  for (unsigned int i=0; i!=n; ++i) {
122  analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i));
123  }
124  } else {
125  analyzeTrigger(iEvent,iSetup,triggerName_);
126  }
127 
128  return;
129 
130 }
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
assert(m_qm.get())
const std::string triggerName_
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
bool isValid() const
Definition: HandleBase.h:75
edm::Handle< edm::TriggerResults > triggerResultsHandle_
additional class data memebers
HLTConfigProvider hltConfig_
void HLTEventAnalyzerAOD::analyzeTrigger ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  triggerName 
)
virtual

Definition at line 132 of file HLTEventAnalyzerAOD.cc.

References assert(), trigger::TriggerObject::eta(), hltConfig_, i, trigger::TriggerObject::id(), j, visualization-live-secondInstance_cfg::m, trigger::TriggerObject::mass(), bookConverter::max, python.rootplot.argparse::message, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), gen::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().

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 60 of file HLTEventAnalyzerAOD.cc.

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

61 {
62  using namespace std;
63  using namespace edm;
64 
65  bool changed(true);
66  if (hltConfig_.init(iRun,iSetup,processName_,changed)) {
67  if (changed) {
68  // check if trigger name in (new) config
69  if (triggerName_!="@") { // "@" means: analyze all triggers in config
70  const unsigned int n(hltConfig_.size());
71  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName_));
72  if (triggerIndex>=n) {
73  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:"
74  << " TriggerName " << triggerName_
75  << " not available in (new) config!" << endl;
76  LogVerbatim("HLTEventAnalyzerAOD") << "Available TriggerNames are: " << endl;
77  hltConfig_.dump("Triggers");
78  }
79  }
80  hltConfig_.dump("ProcessName");
81  hltConfig_.dump("GlobalTag");
82  hltConfig_.dump("TableName");
83  hltConfig_.dump("Streams");
84  hltConfig_.dump("Datasets");
85  hltConfig_.dump("PrescaleTable");
86  hltConfig_.dump("ProcessPSet");
87  }
88  } else {
89  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:"
90  << " config extraction failure with process name "
91  << processName_ << endl;
92  }
93 }
unsigned int size() const
number of trigger paths in trigger table
void dump(const std::string &what) const
Dumping config info to cout.
const std::string triggerName_
const std::string processName_
module config parameters
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
HLTConfigProvider hltConfig_
void HLTEventAnalyzerAOD::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 57 of file HLTEventAnalyzerAOD.cc.

57 {}
void HLTEventAnalyzerAOD::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 47 of file HLTEventAnalyzerAOD.cc.

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

47  {
49  desc.add<std::string>("processName","HLT");
50  desc.add<std::string>("triggerName","@");
51  desc.add<edm::InputTag>("triggerResults",edm::InputTag("TriggerResults","","HLT"));
52  desc.add<edm::InputTag>("triggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT"));
53  descriptions.add("hltEventAnalyzerAOD", desc);
54 }
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 52 of file HLTEventAnalyzerAOD.h.

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

const std::string HLTEventAnalyzerAOD::processName_
private

module config parameters

Definition at line 42 of file HLTEventAnalyzerAOD.h.

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

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

Definition at line 51 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

const edm::InputTag HLTEventAnalyzerAOD::triggerEventTag_
private

Definition at line 46 of file HLTEventAnalyzerAOD.h.

Referenced by HLTEventAnalyzerAOD().

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

Definition at line 47 of file HLTEventAnalyzerAOD.h.

Referenced by analyze().

const std::string HLTEventAnalyzerAOD::triggerName_
private

Definition at line 43 of file HLTEventAnalyzerAOD.h.

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

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

additional class data memebers

Definition at line 50 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

const edm::InputTag HLTEventAnalyzerAOD::triggerResultsTag_
private

Definition at line 44 of file HLTEventAnalyzerAOD.h.

Referenced by HLTEventAnalyzerAOD().

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

Definition at line 45 of file HLTEventAnalyzerAOD.h.

Referenced by analyze().