CMS 3D CMS Logo

Public Member Functions | Private Attributes

HLTEventAnalyzerRAW Class Reference

#include <HLTEventAnalyzerRAW.h>

Inheritance diagram for HLTEventAnalyzerRAW:
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 &)
 HLTEventAnalyzerRAW (const edm::ParameterSet &)
 ~HLTEventAnalyzerRAW ()

Private Attributes

trigger::Vids basemetIds_
trigger::VRbasemet basemetRefs_
trigger::Vids calometIds_
trigger::VRcalomet calometRefs_
trigger::Vids compositeIds_
trigger::VRcomposite compositeRefs_
trigger::Vids electronIds_
trigger::VRelectron electronRefs_
HLTConfigProvider hltConfig_
trigger::Vids jetIds_
trigger::VRjet jetRefs_
trigger::Vids l1emIds_
trigger::VRl1em l1emRefs_
trigger::Vids l1etmissIds_
trigger::VRl1etmiss l1etmissRefs_
trigger::Vids l1hfringsIds_
trigger::VRl1hfrings l1hfringsRefs_
trigger::Vids l1jetIds_
trigger::VRl1jet l1jetRefs_
trigger::Vids l1muonIds_
trigger::VRl1muon l1muonRefs_
trigger::Vids muonIds_
trigger::VRmuon muonRefs_
trigger::Vids pfjetIds_
trigger::VRpfjet pfjetRefs_
trigger::Vids pftauIds_
trigger::VRpftau pftauRefs_
trigger::Vids photonIds_
 payload extracted from TriggerEventWithRefs
trigger::VRphoton photonRefs_
trigger::Vids pixtrackIds_
trigger::VRpixtrack pixtrackRefs_
std::string processName_
 module config parameters
edm::Handle
< trigger::TriggerEventWithRefs
triggerEventWithRefsHandle_
edm::InputTag triggerEventWithRefsTag_
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 RAW

Date:
2012/01/30 09:40:35
Revision:
1.8
Author:
Martin Grunewald

See header file for documentation

Date:
2012/01/30 09:40:35
Revision:
1.14
Author:
Martin Grunewald

Definition at line 26 of file HLTEventAnalyzerRAW.h.


Constructor & Destructor Documentation

HLTEventAnalyzerRAW::HLTEventAnalyzerRAW ( const edm::ParameterSet ps) [explicit]

Definition at line 38 of file HLTEventAnalyzerRAW.cc.

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

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

  cout << "HLTEventAnalyzerRAW configuration: " << endl
       << "   ProcessName = " << processName_ << endl
       << "   TriggerName = " << triggerName_ << endl
       << "   TriggerResultsTag = " << triggerResultsTag_.encode() << endl
       << "   TriggerEventWithRefsTag = " << triggerEventWithRefsTag_.encode() << endl;

}
HLTEventAnalyzerRAW::~HLTEventAnalyzerRAW ( )

Definition at line 55 of file HLTEventAnalyzerRAW.cc.

{
}

Member Function Documentation

void HLTEventAnalyzerRAW::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 94 of file HLTEventAnalyzerRAW.cc.

References analyzeTrigger(), gather_cfg::cout, edm::Event::getByLabel(), hltConfig_, i, edm::HandleBase::isValid(), n, HLTConfigProvider::size(), triggerEventWithRefsHandle_, triggerEventWithRefsTag_, 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 << "HLTEventAnalyzerRAW::analyze: Error in getting TriggerResults product from Event!" << endl;
    return;
  }
  iEvent.getByLabel(triggerEventWithRefsTag_,triggerEventWithRefsHandle_);
  if (!triggerEventWithRefsHandle_.isValid()) {
    cout << "HLTEventAnalyzerRAW::analyze: Error in getting TriggerEventWithRefs 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 HLTEventAnalyzerRAW::analyzeTrigger ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::string &  triggerName 
) [virtual]

Definition at line 129 of file HLTEventAnalyzerRAW.cc.

References basemetIds_, basemetRefs_, calometIds_, calometRefs_, compositeIds_, compositeRefs_, gather_cfg::cout, electronIds_, electronRefs_, hltConfig_, i, j, jetIds_, jetRefs_, l1extra::L1HFRings::kRing1NegEta, l1extra::L1HFRings::kRing1PosEta, l1extra::L1HFRings::kRing2NegEta, l1extra::L1HFRings::kRing2PosEta, l1emIds_, l1emRefs_, l1etmissIds_, l1etmissRefs_, l1hfringsIds_, l1hfringsRefs_, l1jetIds_, l1jetRefs_, l1muonIds_, l1muonRefs_, m, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), muonIds_, muonRefs_, n, pfjetIds_, pfjetRefs_, pftauIds_, pftauRefs_, photonIds_, photonRefs_, pixtrackIds_, pixtrackRefs_, processName_, L1Trigger_dataformats::reco, findQualityFiles::size, HLTConfigProvider::size(), triggerEventWithRefsHandle_, 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 << "HLTEventAnalyzerRAW::analyzeTrigger: path "
         << triggerName << " - not found!" << endl;
    return;
  }
  
  cout << "HLTEventAnalyzerRAW::analyzeTrigger: path "
       << triggerName << " [" << triggerIndex << "]" << 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 TriggerEventWithRefs product
  photonIds_.clear();
  photonRefs_.clear();
  electronIds_.clear();
  electronRefs_.clear();
  muonIds_.clear();
  muonRefs_.clear();
  jetIds_.clear();
  jetRefs_.clear();
  compositeIds_.clear();
  compositeRefs_.clear();
  basemetIds_.clear();
  basemetRefs_.clear();
  calometIds_.clear();
  calometRefs_.clear();
  pixtrackIds_.clear();
  pixtrackRefs_.clear();
  l1emIds_.clear();
  l1emRefs_.clear();
  l1muonIds_.clear();
  l1muonRefs_.clear();
  l1jetIds_.clear();
  l1jetRefs_.clear();
  l1etmissIds_.clear();
  l1etmissRefs_.clear();
  l1hfringsIds_.clear();
  l1hfringsRefs_.clear();
  pfjetIds_.clear();
  pfjetRefs_.clear();
  pftauIds_.clear();
  pftauRefs_.clear();

  // 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 TriggerEventWithRef product
    const unsigned int filterIndex(triggerEventWithRefsHandle_->filterIndex(InputTag(moduleLabel,"",processName_)));
    if (filterIndex<triggerEventWithRefsHandle_->size()) {
      cout << " Filter in slot " << j << " - label/type " << moduleLabel << "/" << moduleType << endl;
      cout << " Filter packed up at: " << filterIndex << endl;
      cout << "  Accepted objects:" << endl;

      triggerEventWithRefsHandle_->getObjects(filterIndex,photonIds_,photonRefs_);
      const unsigned int nPhotons(photonIds_.size());
      if (nPhotons>0) {
        cout << "   Photons: " << nPhotons << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nPhotons; ++i) {
          cout << "   " << i << " " << photonIds_[i]
               << " " << photonRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,electronIds_,electronRefs_);
      const unsigned int nElectrons(electronIds_.size());
      if (nElectrons>0) {
        cout << "   Electrons: " << nElectrons << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nElectrons; ++i) {
          cout << "   " << i << " " << electronIds_[i]
               << " " << electronRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,muonIds_,muonRefs_);
      const unsigned int nMuons(muonIds_.size());
      if (nMuons>0) {
        cout << "   Muons: " << nMuons << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nMuons; ++i) {
          cout << "   " << i << " " << muonIds_[i]
               << " " << muonRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,jetIds_,jetRefs_);
      const unsigned int nJets(jetIds_.size());
      if (nJets>0) {
        cout << "   Jets: " << nJets << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nJets; ++i) {
          cout << "   " << i << " " << jetIds_[i]
               << " " << jetRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,compositeIds_,compositeRefs_);
      const unsigned int nComposites(compositeIds_.size());
      if (nComposites>0) {
        cout << "   Composites: " << nComposites << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nComposites; ++i) {
          cout << "   " << i << " " << compositeIds_[i]
               << " " << compositeRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,basemetIds_,basemetRefs_);
      const unsigned int nBaseMETs(basemetIds_.size());
      if (nBaseMETs>0) {
        cout << "   BaseMETs: " << nBaseMETs << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nBaseMETs; ++i) {
          cout << "   " << i << " " << basemetIds_[i]
               << " " << basemetRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,calometIds_,calometRefs_);
      const unsigned int nCaloMETs(calometIds_.size());
      if (nCaloMETs>0) {
        cout << "   CaloMETs: " << nCaloMETs << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nCaloMETs; ++i) {
          cout << "   " << i << " " << calometIds_[i]
               << " " << calometRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,pixtrackIds_,pixtrackRefs_);
      const unsigned int nPixTracks(pixtrackIds_.size());
      if (nPixTracks>0) {
        cout << "   PixTracks: " << nPixTracks << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nPixTracks; ++i) {
          cout << "   " << i << " " << pixtrackIds_[i]
               << " " << pixtrackRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,l1emIds_,l1emRefs_);
      const unsigned int nL1EM(l1emIds_.size());
      if (nL1EM>0) {
        cout << "   L1EM: " << nL1EM << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nL1EM; ++i) {
          cout << "   " << i << " " << l1emIds_[i]
               << " " << l1emRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,l1muonIds_,l1muonRefs_);
      const unsigned int nL1Muon(l1muonIds_.size());
      if (nL1Muon>0) {
        cout << "   L1Muon: " << nL1Muon << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nL1Muon; ++i) {
          cout << "   " << i << " " << l1muonIds_[i]
               << " " << l1muonRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,l1jetIds_,l1jetRefs_);
      const unsigned int nL1Jet(l1jetIds_.size());
      if (nL1Jet>0) {
        cout << "   L1Jet: " << nL1Jet << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nL1Jet; ++i) {
          cout << "   " << i << " " << l1jetIds_[i]
               << " " << l1jetRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,l1etmissIds_,l1etmissRefs_);
      const unsigned int nL1EtMiss(l1etmissIds_.size());
      if (nL1EtMiss>0) {
        cout << "   L1EtMiss: " << nL1EtMiss << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nL1EtMiss; ++i) {
          cout << "   " << i << " " << l1etmissIds_[i]
               << " " << l1etmissRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,l1hfringsIds_,l1hfringsRefs_);
      const unsigned int nL1HfRings(l1hfringsIds_.size());
      if (nL1HfRings>0) {
        cout << "   L1HfRings: " << nL1HfRings << "  - the objects: # id 4 4" << endl;
        for (unsigned int i=0; i!=nL1HfRings; ++i) {
          cout << "   " << i << " " << l1hfringsIds_[i]
               << " " << l1hfringsRefs_[i]->hfEtSum(l1extra::L1HFRings::kRing1PosEta)
               << " " << l1hfringsRefs_[i]->hfEtSum(l1extra::L1HFRings::kRing1NegEta)
               << " " << l1hfringsRefs_[i]->hfEtSum(l1extra::L1HFRings::kRing2PosEta)
               << " " << l1hfringsRefs_[i]->hfEtSum(l1extra::L1HFRings::kRing2NegEta)
               << " " << l1hfringsRefs_[i]->hfBitCount(l1extra::L1HFRings::kRing1PosEta)
               << " " << l1hfringsRefs_[i]->hfBitCount(l1extra::L1HFRings::kRing1NegEta)
               << " " << l1hfringsRefs_[i]->hfBitCount(l1extra::L1HFRings::kRing2PosEta)
               << " " << l1hfringsRefs_[i]->hfBitCount(l1extra::L1HFRings::kRing2NegEta)
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,pfjetIds_,pfjetRefs_);
      const unsigned int nPFJets(pfjetIds_.size());
      if (nPFJets>0) {
        cout << "   PFJets: " << nPFJets << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nPFJets; ++i) {
          cout << "   " << i << " " << pfjetIds_[i]
               << " " << pfjetRefs_[i]->pt()
               << endl;
        }
      }

      triggerEventWithRefsHandle_->getObjects(filterIndex,pftauIds_,pftauRefs_);
      const unsigned int nPFTaus(pftauIds_.size());
      if (nPFTaus>0) {
        cout << "   PFTaus: " << nPFTaus << "  - the objects: # id pt" << endl;
        for (unsigned int i=0; i!=nPFTaus; ++i) {
          cout << "   " << i << " " << pftauIds_[i]
               << " " << pftauRefs_[i]->pt()
               << endl;
        }
      }

    }
  }

  return;
}
void HLTEventAnalyzerRAW::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file HLTEventAnalyzerRAW.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 << "HLTEventAnalyzerRAW::analyze:"
               << " TriggerName " << triggerName_ 
               << " not available in (new) config!" << endl;
          cout << "Available TriggerNames are: " << endl;
          hltConfig_.dump("Triggers");
        }
      }
    }
  } else {
    cout << "HLTEventAnalyzerRAW::analyze:"
         << " config extraction failure with process name "
         << processName_ << endl;
  }

}

Member Data Documentation

Definition at line 61 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 62 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 63 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 64 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 59 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 60 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 53 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 54 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 47 of file HLTEventAnalyzerRAW.h.

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

Definition at line 57 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 58 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 68 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 69 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 74 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 75 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 76 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 77 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 72 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 73 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 70 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 71 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 55 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 56 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 79 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 80 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 81 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 82 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

payload extracted from TriggerEventWithRefs

Definition at line 51 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 52 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 65 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

Definition at line 66 of file HLTEventAnalyzerRAW.h.

Referenced by analyzeTrigger().

std::string HLTEventAnalyzerRAW::processName_ [private]

module config parameters

Definition at line 39 of file HLTEventAnalyzerRAW.h.

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

Definition at line 46 of file HLTEventAnalyzerRAW.h.

Referenced by analyze(), and analyzeTrigger().

Definition at line 42 of file HLTEventAnalyzerRAW.h.

Referenced by analyze(), and HLTEventAnalyzerRAW().

std::string HLTEventAnalyzerRAW::triggerName_ [private]

Definition at line 40 of file HLTEventAnalyzerRAW.h.

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

additional class data memebers

Definition at line 45 of file HLTEventAnalyzerRAW.h.

Referenced by analyze(), and analyzeTrigger().

Definition at line 41 of file HLTEventAnalyzerRAW.h.

Referenced by analyze(), and HLTEventAnalyzerRAW().