Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-16 06:15:45

0001 /** \class TriggerSummaryAnalyzerRAW
0002  *
0003  *  This class is an EDAnalyzer analyzing the HLT summary object for RAW
0004  *
0005  *
0006  *  \author Martin Grunewald
0007  *
0008  */
0009 
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 
0012 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0018 
0019 //
0020 // class declaration
0021 //
0022 class TriggerSummaryAnalyzerRAW : public edm::global::EDAnalyzer<> {
0023 public:
0024   explicit TriggerSummaryAnalyzerRAW(const edm::ParameterSet&);
0025 
0026   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0027   void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override;
0028 
0029 private:
0030   /// InputTag of TriggerEventWithRefs to analyze
0031   const edm::InputTag inputTag_;
0032   const edm::EDGetTokenT<trigger::TriggerEventWithRefs> inputToken_;
0033 };
0034 
0035 //
0036 // constructors and destructor
0037 //
0038 TriggerSummaryAnalyzerRAW::TriggerSummaryAnalyzerRAW(const edm::ParameterSet& ps)
0039     : inputTag_(ps.getParameter<edm::InputTag>("inputTag")),
0040       inputToken_(consumes<trigger::TriggerEventWithRefs>(inputTag_)) {}
0041 
0042 //
0043 // member functions
0044 //
0045 
0046 void TriggerSummaryAnalyzerRAW::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0047   edm::ParameterSetDescription desc;
0048   desc.add<edm::InputTag>("inputTag", edm::InputTag("hltTriggerSummaryRAW"));
0049   descriptions.add("triggerSummaryAnalyzerRAW", desc);
0050 }
0051 
0052 // ------------ method called to produce the data  ------------
0053 void TriggerSummaryAnalyzerRAW::analyze(edm::StreamID, const edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0054   using namespace std;
0055   using namespace edm;
0056   using namespace reco;
0057   using namespace l1extra;
0058   using namespace trigger;
0059   using namespace l1t;
0060 
0061   LogVerbatim("TriggerSummaryAnalyzerRAW") << endl;
0062   LogVerbatim("TriggerSummaryAnalyzerRAW")
0063       << "TriggerSummaryAnalyzerRAW: content of TriggerEventWithRefs: " << inputTag_.encode();
0064 
0065   Handle<TriggerEventWithRefs> handle;
0066   iEvent.getByToken(inputToken_, handle);
0067   if (handle.isValid()) {
0068     LogVerbatim("TriggerSummaryAnalyzerRAW") << "Used Processname: " << handle->usedProcessName() << endl;
0069     const size_type nFO(handle->size());
0070     LogVerbatim("TriggerSummaryAnalyzerRAW") << "Number of TriggerFilterObjects: " << nFO << endl;
0071     LogVerbatim("TriggerSummaryAnalyzerRAW") << "The TriggerFilterObjects: #, tag" << endl;
0072     for (size_type iFO = 0; iFO != nFO; ++iFO) {
0073       LogVerbatim("TriggerSummaryAnalyzerRAW") << iFO << " " << handle->filterTag(iFO).encode() << endl;
0074       LogVerbatim("TriggerSummaryAnalyzerRAW") << "  # of objects:";
0075 
0076       const unsigned int nPhotons(handle->photonSlice(iFO).second - handle->photonSlice(iFO).first);
0077       if (nPhotons > 0)
0078         LogVerbatim("TriggerSummaryAnalyzerRAW") << " Photons: " << nPhotons;
0079 
0080       const unsigned int nElectrons(handle->electronSlice(iFO).second - handle->electronSlice(iFO).first);
0081       if (nElectrons > 0)
0082         LogVerbatim("TriggerSummaryAnalyzerRAW") << " Electrons: " << nElectrons;
0083 
0084       const unsigned int nMuons(handle->muonSlice(iFO).second - handle->muonSlice(iFO).first);
0085       if (nMuons > 0)
0086         LogVerbatim("TriggerSummaryAnalyzerRAW") << " Muons: " << nMuons;
0087 
0088       const unsigned int nJets(handle->jetSlice(iFO).second - handle->jetSlice(iFO).first);
0089       if (nJets > 0)
0090         LogVerbatim("TriggerSummaryAnalyzerRAW") << " Jets: " << nJets;
0091 
0092       const unsigned int nComposites(handle->compositeSlice(iFO).second - handle->compositeSlice(iFO).first);
0093       if (nComposites > 0)
0094         LogVerbatim("TriggerSummaryAnalyzerRAW") << " Composites: " << nComposites;
0095 
0096       const unsigned int nBaseMETs(handle->basemetSlice(iFO).second - handle->basemetSlice(iFO).first);
0097       if (nBaseMETs > 0)
0098         LogVerbatim("TriggerSummaryAnalyzerRAW") << " BaseMETs: " << nBaseMETs;
0099 
0100       const unsigned int nCaloMETs(handle->calometSlice(iFO).second - handle->calometSlice(iFO).first);
0101       if (nCaloMETs > 0)
0102         LogVerbatim("TriggerSummaryAnalyzerRAW") << " CaloMETs: " << nCaloMETs;
0103 
0104       const unsigned int nPixTracks(handle->pixtrackSlice(iFO).second - handle->pixtrackSlice(iFO).first);
0105       if (nPixTracks > 0)
0106         LogVerbatim("TriggerSummaryAnalyzerRAW") << " PixTracks: " << nPixTracks;
0107 
0108       const unsigned int nL1EM(handle->l1emSlice(iFO).second - handle->l1emSlice(iFO).first);
0109       if (nL1EM > 0)
0110         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1EM: " << nL1EM;
0111 
0112       const unsigned int nL1Muon(handle->l1muonSlice(iFO).second - handle->l1muonSlice(iFO).first);
0113       if (nL1Muon > 0)
0114         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1Muon: " << nL1Muon;
0115 
0116       const unsigned int nL1Jet(handle->l1jetSlice(iFO).second - handle->l1jetSlice(iFO).first);
0117       if (nL1Jet > 0)
0118         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1Jet: " << nL1Jet;
0119 
0120       const unsigned int nL1EtMiss(handle->l1etmissSlice(iFO).second - handle->l1etmissSlice(iFO).first);
0121       if (nL1EtMiss > 0)
0122         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1EtMiss: " << nL1EtMiss;
0123 
0124       const unsigned int nL1HfRings(handle->l1hfringsSlice(iFO).second - handle->l1hfringsSlice(iFO).first);
0125       if (nL1HfRings > 0)
0126         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1HfRings: " << nL1HfRings;
0127 
0128       const unsigned int nPFJets(handle->pfjetSlice(iFO).second - handle->pfjetSlice(iFO).first);
0129       if (nPFJets > 0)
0130         LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFJets: " << nPFJets;
0131 
0132       const unsigned int nPFTaus(handle->pftauSlice(iFO).second - handle->pftauSlice(iFO).first);
0133       if (nPFTaus > 0)
0134         LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFTaus: " << nPFTaus;
0135 
0136       const unsigned int nPFMETs(handle->pfmetSlice(iFO).second - handle->pfmetSlice(iFO).first);
0137       if (nPFMETs > 0)
0138         LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFMETs: " << nPFMETs;
0139 
0140       const unsigned int nL1TMuon(handle->l1tmuonSlice(iFO).second - handle->l1tmuonSlice(iFO).first);
0141       if (nL1TMuon > 0)
0142         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TMuon: " << nL1TMuon;
0143 
0144       const unsigned int nL1TMuonShower(handle->l1tmuonShowerSlice(iFO).second - handle->l1tmuonShowerSlice(iFO).first);
0145       if (nL1TMuonShower > 0)
0146         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TMuonShower: " << nL1TMuonShower;
0147 
0148       const unsigned int nL1TEGamma(handle->l1tegammaSlice(iFO).second - handle->l1tegammaSlice(iFO).first);
0149       if (nL1TEGamma > 0)
0150         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TEGamma: " << nL1TEGamma;
0151 
0152       const unsigned int nL1TJet(handle->l1tjetSlice(iFO).second - handle->l1tjetSlice(iFO).first);
0153       if (nL1TJet > 0)
0154         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TJet: " << nL1TJet;
0155 
0156       const unsigned int nL1TTau(handle->l1ttauSlice(iFO).second - handle->l1ttauSlice(iFO).first);
0157       if (nL1TTau > 0)
0158         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTau: " << nL1TTau;
0159 
0160       const unsigned int nL1TEtSum(handle->l1tetsumSlice(iFO).second - handle->l1tetsumSlice(iFO).first);
0161       if (nL1TEtSum > 0)
0162         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TEtSum: " << nL1TEtSum;
0163 
0164       /* Phase-2 */
0165       const unsigned int nL1TTkMuon(handle->l1ttkmuonSlice(iFO).second - handle->l1ttkmuonSlice(iFO).first);
0166       if (nL1TTkMuon > 0)
0167         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkMuon: " << nL1TTkMuon;
0168 
0169       const unsigned int nL1TTkEle(handle->l1ttkeleSlice(iFO).second - handle->l1ttkeleSlice(iFO).first);
0170       if (nL1TTkEle > 0)
0171         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkEle: " << nL1TTkEle;
0172 
0173       const unsigned int nL1TTkEm(handle->l1ttkemSlice(iFO).second - handle->l1ttkemSlice(iFO).first);
0174       if (nL1TTkEm > 0)
0175         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkEm: " << nL1TTkEm;
0176 
0177       const unsigned int nL1TPFJet(handle->l1tpfjetSlice(iFO).second - handle->l1tpfjetSlice(iFO).first);
0178       if (nL1TPFJet > 0)
0179         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TPFJet: " << nL1TPFJet;
0180 
0181       const unsigned int nL1TPFTau(handle->l1tpftauSlice(iFO).second - handle->l1tpftauSlice(iFO).first);
0182       if (nL1TPFTau > 0)
0183         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TPFTau: " << nL1TPFTau;
0184 
0185       const unsigned int nL1THPSPFTau(handle->l1thpspftauSlice(iFO).second - handle->l1thpspftauSlice(iFO).first);
0186       if (nL1THPSPFTau > 0)
0187         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1THPSPFTau: " << nL1THPSPFTau;
0188 
0189       const unsigned int nL1TPFTrack(handle->l1tpftrackSlice(iFO).second - handle->l1tpftrackSlice(iFO).first);
0190       if (nL1TPFTrack > 0)
0191         LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TPFTrack: " << nL1TPFTrack;
0192 
0193       LogVerbatim("TriggerSummaryAnalyzerRAW") << endl;
0194     }
0195     LogVerbatim("TriggerSummaryAnalyzerRAW") << "Elements in linearised collections of Refs: " << endl;
0196     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Photons:       " << handle->photonSize() << endl;
0197     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Electrons:     " << handle->electronSize() << endl;
0198     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Muons:         " << handle->muonSize() << endl;
0199     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Jets:          " << handle->jetSize() << endl;
0200     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Composites:    " << handle->compositeSize() << endl;
0201     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  BaseMETs:      " << handle->basemetSize() << endl;
0202     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  CaloMETs:      " << handle->calometSize() << endl;
0203     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  Pixtracks:     " << handle->pixtrackSize() << endl;
0204     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1EM:          " << handle->l1emSize() << endl;
0205     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1Muon:        " << handle->l1muonSize() << endl;
0206     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1Jet:         " << handle->l1jetSize() << endl;
0207     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1EtMiss:      " << handle->l1etmissSize() << endl;
0208     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1HfRings:     " << handle->l1hfringsSize() << endl;
0209     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  PFJets:        " << handle->pfjetSize() << endl;
0210     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  PFTaus:        " << handle->pftauSize() << endl;
0211     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  PFMETs:        " << handle->pfmetSize() << endl;
0212     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TMuon:       " << handle->l1tmuonSize() << endl;
0213     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TMuonShower: " << handle->l1tmuonShowerSize() << endl;
0214     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TEGamma:     " << handle->l1tegammaSize() << endl;
0215     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TJet:        " << handle->l1tjetSize() << endl;
0216     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TTau:        " << handle->l1ttauSize() << endl;
0217     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TEtSum:      " << handle->l1tetsumSize() << endl;
0218     /* Phase-2 */
0219     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TTkMuon:    " << handle->l1ttkmuonSize() << endl;
0220     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TTkEle:     " << handle->l1ttkeleSize() << endl;
0221     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TTkEm:      " << handle->l1ttkemSize() << endl;
0222     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TPFJet:     " << handle->l1tpfjetSize() << endl;
0223     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TPFTau:     " << handle->l1tpftauSize() << endl;
0224     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1THPSPFTau:  " << handle->l1thpspftauSize() << endl;
0225     LogVerbatim("TriggerSummaryAnalyzerRAW") << "  L1TPFTrack:   " << handle->l1tpftrackSize() << endl;
0226 
0227   } else {
0228     LogVerbatim("TriggerSummaryAnalyzerRAW") << "Handle invalid! Check InputTag provided." << endl;
0229   }
0230   LogVerbatim("TriggerSummaryAnalyzerRAW") << endl;
0231 
0232   return;
0233 }
0234 
0235 DEFINE_FWK_MODULE(TriggerSummaryAnalyzerRAW);