CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerAOD.cc

Go to the documentation of this file.
00001 
00012 #include "HLTrigger/HLTcore/interface/TriggerSummaryAnalyzerAOD.h"
00013 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00014 
00015 //
00016 // constructors and destructor
00017 //
00018 TriggerSummaryAnalyzerAOD::TriggerSummaryAnalyzerAOD(const edm::ParameterSet& ps) : 
00019   inputTag_(ps.getParameter<edm::InputTag>("inputTag"))
00020 { }
00021 
00022 TriggerSummaryAnalyzerAOD::~TriggerSummaryAnalyzerAOD()
00023 {
00024 }
00025 
00026 //
00027 // member functions
00028 //
00029 
00030 // ------------ method called to produce the data  ------------
00031 void
00032 TriggerSummaryAnalyzerAOD::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00033 {
00034    using namespace std;
00035    using namespace edm;
00036    using namespace reco;
00037    using namespace trigger;
00038 
00039 
00040    cout << endl;
00041    cout << "TriggerSummaryAnalyzerAOD: content of TriggerEvent: " << inputTag_.encode() << endl;
00042 
00043    Handle<TriggerEvent> handle;
00044    iEvent.getByLabel(inputTag_,handle);
00045    if (handle.isValid()) {
00046      cout << "Used Processname: " << handle->usedProcessName() << endl;
00047      const size_type nC(handle->sizeCollections());
00048      cout << "Number of packed Collections: " << nC << endl;
00049      cout << "The Collections: #, tag, 1-past-end index" << endl;
00050      for (size_type iC=0; iC!=nC; ++iC) {
00051        cout << iC << " "
00052             << handle->collectionTag(iC).encode() << " "
00053             << handle->collectionKey(iC) << endl;
00054      }
00055      const size_type nO(handle->sizeObjects());
00056      cout << "Number of TriggerObjects: " << nO << endl;
00057      cout << "The TriggerObjects: #, id, pt, eta, phi, mass" << endl;
00058      const TriggerObjectCollection& TOC(handle->getObjects());
00059      for (size_type iO=0; iO!=nO; ++iO) {
00060        const TriggerObject& TO(TOC[iO]);
00061        cout << iO << " " << TO.id() << " " << TO.pt() << " " << TO.eta() << " " << TO.phi() << " " << TO.mass() << endl;
00062      }
00063      const size_type nF(handle->sizeFilters());
00064      cout << "Number of TriggerFilters: " << nF << endl;
00065      cout << "The Filters: #, tag, #ids/#keys, the id/key pairs" << endl;
00066      for (size_type iF=0; iF!=nF; ++iF) {
00067        const Vids& VIDS (handle->filterIds(iF));
00068        const Keys& KEYS(handle->filterKeys(iF));
00069        const size_type nI(VIDS.size());
00070        const size_type nK(KEYS.size());
00071        cout << iF << " " << handle->filterTag(iF).encode()
00072             << " " << nI << "/" << nK
00073             << " the pairs: ";
00074        const size_type n(max(nI,nK));
00075        for (size_type i=0; i!=n; ++i) {
00076          cout << " " << VIDS[i] << "/" << KEYS[i];
00077        }
00078        cout << endl;
00079        assert (nI==nK);
00080      }
00081    } else {
00082      cout << "Handle invalid! Check InputTag provided." << endl;
00083    }
00084    cout << endl;
00085    
00086    return;
00087 }