Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:09:22

0001 #ifndef HLTrigger_HLTcore_HLTEventAnalyzerRAW_h
0002 #define HLTrigger_HLTcore_HLTEventAnalyzerRAW_h
0003 
0004 /** \class HLTEventAnalyzerRAW
0005  *
0006  *
0007  *  This class is an EDAnalyzer analyzing the combined HLT information for RAW
0008  *
0009  *
0010  *  \author Martin Grunewald
0011  *
0012  */
0013 
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/stream/EDAnalyzer.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0019 #include "DataFormats/Common/interface/TriggerResults.h"
0020 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
0021 
0022 namespace edm {
0023   class ConfigurationDescriptions;
0024 }
0025 
0026 //
0027 // class declaration
0028 //
0029 class HLTEventAnalyzerRAW : public edm::stream::EDAnalyzer<> {
0030 public:
0031   explicit HLTEventAnalyzerRAW(const edm::ParameterSet&);
0032   ~HLTEventAnalyzerRAW() override = default;
0033   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0034 
0035   void beginRun(edm::Run const&, edm::EventSetup const&) override;
0036   void endRun(edm::Run const&, edm::EventSetup const&) override {}
0037 
0038   void analyze(const edm::Event&, const edm::EventSetup&) override;
0039 
0040   virtual void analyzeTrigger(const edm::Event&, const edm::EventSetup&, const std::string& triggerName);
0041 
0042 private:
0043   using LOG = edm::LogVerbatim;
0044 
0045   static constexpr const char* logMsgType_ = "HLTEventAnalyzerRAW";
0046 
0047   template <class TVID, class TVREF>
0048   void showObjects(TVID const& vids, TVREF const& vrefs, std::string const& name) const;
0049 
0050   template <class TREF>
0051   void showObject(LOG& log, TREF const& ref) const;
0052 
0053   /// module config parameters
0054   const std::string processName_;
0055   const std::string triggerName_;
0056   const edm::InputTag triggerResultsTag_;
0057   const edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken_;
0058   const edm::InputTag triggerEventWithRefsTag_;
0059   const edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerEventWithRefsToken_;
0060 
0061   /// additional class data members
0062   bool const verbose_;
0063   bool const permissive_;
0064 
0065   edm::Handle<edm::TriggerResults> triggerResultsHandle_;
0066   edm::Handle<trigger::TriggerEventWithRefs> triggerEventWithRefsHandle_;
0067 
0068   HLTConfigProvider hltConfig_;
0069 
0070   /// payload extracted from TriggerEventWithRefs
0071   trigger::Vids photonIds_;
0072   trigger::VRphoton photonRefs_;
0073   trigger::Vids electronIds_;
0074   trigger::VRelectron electronRefs_;
0075   trigger::Vids muonIds_;
0076   trigger::VRmuon muonRefs_;
0077   trigger::Vids jetIds_;
0078   trigger::VRjet jetRefs_;
0079   trigger::Vids compositeIds_;
0080   trigger::VRcomposite compositeRefs_;
0081   trigger::Vids basemetIds_;
0082   trigger::VRbasemet basemetRefs_;
0083   trigger::Vids calometIds_;
0084   trigger::VRcalomet calometRefs_;
0085   trigger::Vids pixtrackIds_;
0086   trigger::VRpixtrack pixtrackRefs_;
0087 
0088   trigger::Vids l1emIds_;
0089   trigger::VRl1em l1emRefs_;
0090   trigger::Vids l1muonIds_;
0091   trigger::VRl1muon l1muonRefs_;
0092   trigger::Vids l1jetIds_;
0093   trigger::VRl1jet l1jetRefs_;
0094   trigger::Vids l1etmissIds_;
0095   trigger::VRl1etmiss l1etmissRefs_;
0096   trigger::Vids l1hfringsIds_;
0097   trigger::VRl1hfrings l1hfringsRefs_;
0098 
0099   trigger::Vids l1tmuonIds_;
0100   trigger::VRl1tmuon l1tmuonRefs_;
0101   trigger::Vids l1tmuonShowerIds_;
0102   trigger::VRl1tmuonShower l1tmuonShowerRefs_;
0103   trigger::Vids l1tegammaIds_;
0104   trigger::VRl1tegamma l1tegammaRefs_;
0105   trigger::Vids l1tjetIds_;
0106   trigger::VRl1tjet l1tjetRefs_;
0107   trigger::Vids l1ttauIds_;
0108   trigger::VRl1ttau l1ttauRefs_;
0109   trigger::Vids l1tetsumIds_;
0110   trigger::VRl1tetsum l1tetsumRefs_;
0111 
0112   /// Phase 2
0113   trigger::Vids l1ttkmuIds_;
0114   trigger::VRl1ttkmuon l1ttkmuRefs_;
0115   trigger::Vids l1ttkeleIds_;
0116   trigger::VRl1ttkele l1ttkeleRefs_;
0117   trigger::Vids l1ttkemIds_;
0118   trigger::VRl1ttkem l1ttkemRefs_;
0119   trigger::Vids l1tpfjetIds_;
0120   trigger::VRl1tpfjet l1tpfjetRefs_;
0121   trigger::Vids l1tpftauIds_;
0122   trigger::VRl1tpftau l1tpftauRefs_;
0123   trigger::Vids l1thpspftauIds_;
0124   trigger::VRl1thpspftau l1thpspftauRefs_;
0125   trigger::Vids l1tpftrackIds_;
0126   trigger::VRl1tpftrack l1tpftrackRefs_;
0127 
0128   trigger::Vids pfjetIds_;
0129   trigger::VRpfjet pfjetRefs_;
0130   trigger::Vids pftauIds_;
0131   trigger::VRpftau pftauRefs_;
0132   trigger::Vids pfmetIds_;
0133   trigger::VRpfmet pfmetRefs_;
0134 };
0135 
0136 template <class TVID, class TVREF>
0137 void HLTEventAnalyzerRAW::showObjects(TVID const& vids, TVREF const& vrefs, std::string const& name) const {
0138   size_t const size = vids.size();
0139   assert(size == vrefs.size());
0140 
0141   if (size == 0) {
0142     return;
0143   }
0144 
0145   LOG(logMsgType_) << "   " << name << ": size=" << size;
0146   for (size_t idx = 0; idx < size; ++idx) {
0147     LOG log(logMsgType_);
0148     log << "    [" << idx << "] id=" << vids[idx] << " ";
0149     auto const& ref = vrefs[idx];
0150     if (permissive_ and not ref.isAvailable()) {
0151       log << "(Ref with id=" << ref.id() << " not available)";
0152     } else {
0153       showObject(log, ref);
0154     }
0155   }
0156 }
0157 
0158 template <class TREF>
0159 void HLTEventAnalyzerRAW::showObject(LOG& log, TREF const& ref) const {
0160   log << "pt=" << ref->pt() << " eta=" << ref->eta() << " phi=" << ref->phi() << " mass=" << ref->mass();
0161 }
0162 
0163 template <>
0164 void HLTEventAnalyzerRAW::showObject(LOG& log, trigger::VRl1hfrings::value_type const& ref) const;
0165 
0166 #endif  // HLTrigger_HLTcore_HLTEventAnalyzerRAW_h