CMS 3D CMS Logo

Public Member Functions | Private Attributes

HLTEventAnalyzerAOD Class Reference

#include <HLTEventAnalyzerAOD.h>

Inheritance diagram for HLTEventAnalyzerAOD:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

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

Private Attributes

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

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_.

                                                                  : 
  processName_(ps.getParameter<std::string>("processName")),
  triggerName_(ps.getParameter<std::string>("triggerName")),
  triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
  triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent"))
{
  using namespace std;
  using namespace edm;

  cout << "HLTEventAnalyzerAOD configuration: " << endl
       << "   ProcessName = " << processName_ << endl
       << "   TriggerName = " << triggerName_ << endl
       << "   TriggerResultsTag = " << triggerResultsTag_.encode() << endl
       << "   TriggerEventTag = " << triggerEventTag_.encode() << endl;

}
HLTEventAnalyzerAOD::~HLTEventAnalyzerAOD ( )

Definition at line 37 of file HLTEventAnalyzerAOD.cc.

{
}

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_.

{
  using namespace std;
  using namespace edm;
  
  cout << endl;

  // get event products
  iEvent.getByLabel(triggerResultsTag_,triggerResultsHandle_);
  if (!triggerResultsHandle_.isValid()) {
    cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
    return;
  }
  iEvent.getByLabel(triggerEventTag_,triggerEventHandle_);
  if (!triggerEventHandle_.isValid()) {
    cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
    return;
  }
  // sanity check
  assert(triggerResultsHandle_->size()==hltConfig_.size());
  
  // analyze this event for the triggers requested
  if (triggerName_=="@") {
    const unsigned int n(hltConfig_.size());
    for (unsigned int i=0; i!=n; ++i) {
      analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i));
    }
  } else {
    analyzeTrigger(iEvent,iSetup,triggerName_);
  }

  return;

}
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_, HLTConfigProvider::triggerIndex(), edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), and triggerResultsHandle_.

Referenced by analyze().

                                                                                                                          {
  
  using namespace std;
  using namespace edm;
  using namespace reco;
  using namespace trigger;

  cout << endl;

  const unsigned int n(hltConfig_.size());
  const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName));
  assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName));

  // abort on invalid trigger name
  if (triggerIndex>=n) {
    cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
         << triggerName << " - not found!" << endl;
    return;
  }
  
  const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerName));
  cout << "HLTEventAnalyzerAOD::analyzeTrigger: path "
       << triggerName << " [" << triggerIndex << "] "
       << "prescales L1T,HLT: " << prescales.first << "," << prescales.second
       << endl;

  // modules on this trigger path
  const unsigned int m(hltConfig_.size(triggerIndex));
  const vector<string>& moduleLabels(hltConfig_.moduleLabels(triggerIndex));

  // Results from TriggerResults product
  cout << " Trigger path status:"
       << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
       << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
       << " Error =" << triggerResultsHandle_->error(triggerIndex)
       << endl;
  const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex));
  cout << " Last active module - label/type: "
       << moduleLabels[moduleIndex] << "/" << hltConfig_.moduleType(moduleLabels[moduleIndex])
       << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]"
       << endl;
  assert (moduleIndex<m);

  // Results from TriggerEvent product - Attention: must look only for
  // modules actually run in this path for this event!
  for (unsigned int j=0; j<=moduleIndex; ++j) {
    const string& moduleLabel(moduleLabels[j]);
    const string  moduleType(hltConfig_.moduleType(moduleLabel));
    // check whether the module is packed up in TriggerEvent product
    const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
    if (filterIndex<triggerEventHandle_->sizeFilters()) {
      cout << " 'L3' filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
      const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex));
      const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex));
      const size_type nI(VIDS.size());
      const size_type nK(KEYS.size());
      assert(nI==nK);
      const size_type n(max(nI,nK));
      cout << "   " << n  << " accepted 'L3' objects found: " << endl;
      const TriggerObjectCollection& TOC(triggerEventHandle_->getObjects());
      for (size_type i=0; i!=n; ++i) {
        const TriggerObject& TO(TOC[KEYS[i]]);
        cout << "   " << i << " " << VIDS[i] << "/" << KEYS[i] << ": "
             << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass()
             << endl;
      }
    }
  }

   return;
}
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_.

{
  using namespace std;
  using namespace edm;

  bool changed(true);
  if (hltConfig_.init(iRun,iSetup,processName_,changed)) {
    if (changed) {
      // check if trigger name in (new) config
      if (triggerName_!="@") { // "@" means: analyze all triggers in config
        const unsigned int n(hltConfig_.size());
        const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName_));
        if (triggerIndex>=n) {
          cout << "HLTEventAnalyzerAOD::analyze:"
               << " TriggerName " << triggerName_ 
               << " not available in (new) config!" << endl;
          cout << "Available TriggerNames are: " << endl;
          hltConfig_.dump("Triggers");
        }
      }
      hltConfig_.dump("ProcessName");
      hltConfig_.dump("GlobalTag");
      hltConfig_.dump("TableName");
      hltConfig_.dump("Streams");
      hltConfig_.dump("Datasets");
      hltConfig_.dump("PrescaleTable");
      hltConfig_.dump("ProcessPSet");
    }
  } else {
    cout << "HLTEventAnalyzerAOD::analyze:"
         << " config extraction failure with process name "
         << processName_ << endl;
  }
}

Member Data Documentation

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

Definition at line 46 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

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

additional class data memebers

Definition at line 45 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and analyzeTrigger().

Definition at line 41 of file HLTEventAnalyzerAOD.h.

Referenced by analyze(), and HLTEventAnalyzerAOD().