CMS 3D CMS Logo

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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

HLTPrescaleProvider hltPrescaleProvider_
 
const std::string processName_
 module config parameters More...
 
edm::Handle< trigger::TriggerEventtriggerEventHandle_
 
const edm::InputTag triggerEventTag_
 
const edm::EDGetTokenT< trigger::TriggerEventtriggerEventToken_
 
const std::string triggerName_
 
edm::Handle< edm::TriggerResultstriggerResultsHandle_
 additional class data memebers More...
 
const edm::InputTag triggerResultsTag_
 
const edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken_
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 22 of file HLTEventAnalyzerAOD.cc.

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

22  :
23  processName_(ps.getParameter<std::string>("processName")),
24  triggerName_(ps.getParameter<std::string>("triggerName")),
25  triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
26  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
27  triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent")),
28  triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_)),
30 {
31  using namespace std;
32  using namespace edm;
33 
34  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD configuration: " << endl
35  << " ProcessName = " << processName_ << endl
36  << " TriggerName = " << triggerName_ << endl
37  << " TriggerResultsTag = " << triggerResultsTag_.encode() << endl
38  << " TriggerEventTag = " << triggerEventTag_.encode() << endl;
39 
40 }
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:165
HLTPrescaleProvider hltPrescaleProvider_
const edm::InputTag triggerEventTag_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
HLT enums.
HLTEventAnalyzerAOD::~HLTEventAnalyzerAOD ( )
virtual

Definition at line 42 of file HLTEventAnalyzerAOD.cc.

43 {
44 }

Member Function Documentation

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

Definition at line 103 of file HLTEventAnalyzerAOD.cc.

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

104 {
105  using namespace std;
106  using namespace edm;
107 
108  LogVerbatim("HLTEventAnalyzerAOD") << endl;
109 
110  // get event products
113  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
114  return;
115  }
117  if (!triggerEventHandle_.isValid()) {
118  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
119  return;
120  }
121 
123 
124  // sanity check
125  assert(triggerResultsHandle_->size()==hltConfig.size());
126 
127  // analyze this event for the triggers requested
128  if (triggerName_=="@") {
129  const unsigned int n(hltConfig.size());
130  for (unsigned int i=0; i!=n; ++i) {
131  analyzeTrigger(iEvent,iSetup,hltConfig.triggerName(i));
132  }
133  } else {
134  analyzeTrigger(iEvent,iSetup,triggerName_);
135  }
136 
137  return;
138 
139 }
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:457
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const std::string triggerName_
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
HLTPrescaleProvider hltPrescaleProvider_
unsigned int size() const
Get number of paths stored.
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
bool isValid() const
Definition: HandleBase.h:75
edm::Handle< edm::TriggerResults > triggerResultsHandle_
additional class data memebers
HLTConfigProvider const & hltConfigProvider() const
HLT enums.
void HLTEventAnalyzerAOD::analyzeTrigger ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  triggerName 
)
virtual

Definition at line 141 of file HLTEventAnalyzerAOD.cc.

References edm::HLTGlobalStatus::accept(), edm::HLTGlobalStatus::error(), trigger::TriggerObject::eta(), trigger::TriggerEvent::filterIds(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::getObjects(), HLTPrescaleProvider::hltConfigProvider(), hltPrescaleProvider_, i, trigger::TriggerObject::id(), edm::HLTGlobalStatus::index(), j, funct::m, trigger::TriggerObject::mass(), hpstanc_transforms::max, python.rootplot.argparse::message, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), gen::n, trigger::TriggerObject::phi(), HLTPrescaleProvider::prescaleValues(), HLTPrescaleProvider::prescaleValuesInDetail(), processName_, trigger::TriggerObject::pt(), HLTConfigProvider::size(), triggerEventHandle_, edm::TriggerNames::triggerIndex(), HLTConfigProvider::triggerIndex(), edm::Event::triggerNames(), triggerResultsHandle_, and edm::HLTGlobalStatus::wasrun().

Referenced by analyze().

141  {
142 
143  using namespace std;
144  using namespace edm;
145  using namespace reco;
146  using namespace trigger;
147 
148  LogVerbatim("HLTEventAnalyzerAOD") << endl;
149 
151 
152  const unsigned int n(hltConfig.size());
153  const unsigned int triggerIndex(hltConfig.triggerIndex(triggerName));
154  assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName));
155 
156  // abort on invalid trigger name
157  if (triggerIndex>=n) {
158  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyzeTrigger: path "
159  << triggerName << " - not found!" << endl;
160  return;
161  }
162 
163  const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,triggerName));
164  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyzeTrigger: path "
165  << triggerName << " [" << triggerIndex << "] "
166  << "prescales L1T,HLT: " << prescales.first << "," << prescales.second
167  << endl;
168  const std::pair<std::vector<std::pair<std::string,int> >,int> prescalesInDetail(hltPrescaleProvider_.prescaleValuesInDetail(iEvent,iSetup,triggerName));
169  std::ostringstream message;
170  for (unsigned int i=0; i<prescalesInDetail.first.size(); ++i) {
171  message << " " << i << ":" << prescalesInDetail.first[i].first << "/" << prescalesInDetail.first[i].second;
172  }
173  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyzeTrigger: path "
174  << triggerName << " [" << triggerIndex << "] "
175  << endl
176  << "prescales L1T: " << prescalesInDetail.first.size() << message.str()
177  << endl
178  << " prescale HLT: " << prescalesInDetail.second
179  << endl;
180 
181  // modules on this trigger path
182  const unsigned int m(hltConfig.size(triggerIndex));
183  const vector<string>& moduleLabels(hltConfig.moduleLabels(triggerIndex));
184 
185  // Results from TriggerResults product
186  LogVerbatim("HLTEventAnalyzerAOD") << " Trigger path status:"
187  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
188  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
189  << " Error =" << triggerResultsHandle_->error(triggerIndex)
190  << endl;
191  const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex));
192  LogVerbatim("HLTEventAnalyzerAOD") << " Last active module - label/type: "
193  << moduleLabels[moduleIndex] << "/" << hltConfig.moduleType(moduleLabels[moduleIndex])
194  << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]"
195  << endl;
196  assert (moduleIndex<m);
197 
198  // Results from TriggerEvent product - Attention: must look only for
199  // modules actually run in this path for this event!
200  for (unsigned int j=0; j<=moduleIndex; ++j) {
201  const string& moduleLabel(moduleLabels[j]);
202  const string moduleType(hltConfig.moduleType(moduleLabel));
203  // check whether the module is packed up in TriggerEvent product
204  const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
205  if (filterIndex<triggerEventHandle_->sizeFilters()) {
206  LogVerbatim("HLTEventAnalyzerAOD") << " 'L3' filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
207  const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex));
208  const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex));
209  const size_type nI(VIDS.size());
210  const size_type nK(KEYS.size());
211  assert(nI==nK);
212  const size_type n(max(nI,nK));
213  LogVerbatim("HLTEventAnalyzerAOD") << " " << n << " accepted 'L3' objects found: " << endl;
215  for (size_type i=0; i!=n; ++i) {
216  const TriggerObject& TO(TOC[KEYS[i]]);
217  LogVerbatim("HLTEventAnalyzerAOD") << " " << i << " " << VIDS[i] << "/" << KEYS[i] << ": "
218  << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass()
219  << endl;
220  }
221  }
222  }
223 
224  return;
225 }
unsigned int size() const
number of trigger paths in trigger table
int i
Definition: DBlmapReader.cc:9
bool wasrun() const
Was at least one path run?
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:234
std::pair< std::vector< std::pair< std::string, int > >, int > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
const std::string moduleType(const std::string &module) const
C++ class name of module.
bool accept() const
Has at least one path accepted the event?
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
edm::Handle< trigger::TriggerEvent > triggerEventHandle_
const std::string processName_
module config parameters
uint16_t size_type
HLTPrescaleProvider hltPrescaleProvider_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:110
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
bool error() const
Has any path encountered an error (exception)
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)
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
HLTConfigProvider const & hltConfigProvider() const
fixed size matrix
HLT enums.
std::vector< int > Vids
void HLTEventAnalyzerAOD::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 63 of file HLTEventAnalyzerAOD.cc.

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

64 {
65  using namespace std;
66  using namespace edm;
67 
68  bool changed(true);
69  if (hltPrescaleProvider_.init(iRun,iSetup,processName_,changed)) {
70 
72 
73  if (changed) {
74  // check if trigger name in (new) config
75  if (triggerName_!="@") { // "@" means: analyze all triggers in config
76  const unsigned int n(hltConfig.size());
77  const unsigned int triggerIndex(hltConfig.triggerIndex(triggerName_));
78  if (triggerIndex>=n) {
79  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:"
80  << " TriggerName " << triggerName_
81  << " not available in (new) config!" << endl;
82  LogVerbatim("HLTEventAnalyzerAOD") << "Available TriggerNames are: " << endl;
83  hltConfig.dump("Triggers");
84  }
85  }
86  hltConfig.dump("ProcessName");
87  hltConfig.dump("GlobalTag");
88  hltConfig.dump("TableName");
89  hltConfig.dump("Streams");
90  hltConfig.dump("Datasets");
91  hltConfig.dump("PrescaleTable");
92  hltConfig.dump("ProcessPSet");
93  }
94  } else {
95  LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:"
96  << " config extraction failure with process name "
97  << processName_ << endl;
98  }
99 }
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
HLTPrescaleProvider hltPrescaleProvider_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
HLTConfigProvider const & hltConfigProvider() const
HLT enums.
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
void HLTEventAnalyzerAOD::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 60 of file HLTEventAnalyzerAOD.cc.

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

Definition at line 50 of file HLTEventAnalyzerAOD.cc.

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

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

Member Data Documentation

HLTPrescaleProvider HLTEventAnalyzerAOD::hltPrescaleProvider_
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().