Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:50

0001 #ifndef DQMOnline_Trigger_HLTDQMHistTnPColl_h
0002 #define DQMOnline_Trigger_HLTDQMHistTnPColl_h
0003 
0004 //********************************************************************************
0005 //
0006 // Description:
0007 //   This class allows additional, collection specific requirements to be placed
0008 //   on the tag electron. For example when measuring the second leg of
0009 //   an unseeded double electron trigger, you need to ensure the tag passes
0010 //   the first leg of the trigger.
0011 //
0012 //   Some debate on whether this should inherit from or own a HLTDQMFilterEffHists
0013 //   Because the fill interface is different, I eventually decided it owns a copy
0014 //   rather than mucking around with inheritance
0015 //
0016 // Author : Sam Harper , RAL, May 2017
0017 //
0018 //***********************************************************************************
0019 
0020 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 #include "DQMOffline/Trigger/interface/HLTDQMFilterEffHists.h"
0024 #include "DQMOffline/Trigger/interface/UtilFuncs.h"
0025 
0026 #include <string>
0027 
0028 template <typename TagType, typename ProbeType = TagType>
0029 class HLTDQMFilterTnPEffHists {
0030 public:
0031   typedef dqm::legacy::MonitorElement MonitorElement;
0032   typedef dqm::legacy::DQMStore DQMStore;
0033 
0034   HLTDQMFilterTnPEffHists(const edm::ParameterSet& config,
0035                           const std::string& baseHistName,
0036                           const std::string& hltProcess)
0037       : histColl_(config, baseHistName, hltProcess),
0038         tagExtraFilter_(config.getParameter<std::string>("tagExtraFilter")),
0039         hltProcess_(hltProcess) {}
0040 
0041   static edm::ParameterSetDescription makePSetDescription() {
0042     edm::ParameterSetDescription desc = HLTDQMFilterEffHists<ProbeType>::makePSetDescription();
0043     desc.add<std::string>("tagExtraFilter", "");
0044     return desc;
0045   }
0046   static edm::ParameterSetDescription makePSetDescriptionHistConfigs() {
0047     return HLTDQMFilterEffHists<ProbeType>::makePSetDescriptionHistConfigs();
0048   }
0049 
0050   void bookHists(DQMStore::IBooker& iBooker, const std::vector<edm::ParameterSet>& histConfigs) {
0051     histColl_.bookHists(iBooker, histConfigs);
0052   }
0053   void fillHists(const TagType& tag,
0054                  const ProbeType& probe,
0055                  const edm::Event& event,
0056                  const edm::EventSetup& setup,
0057                  const trigger::TriggerEvent& trigEvt) {
0058     if (tagExtraFilter_.empty() || hltdqm::passTrig(tag.eta(), tag.phi(), trigEvt, tagExtraFilter_, hltProcess_)) {
0059       histColl_.fillHists(probe, event, setup, trigEvt);
0060     }
0061   }
0062 
0063 private:
0064   //these hists take the probe as input hence they are of ProbeType
0065   HLTDQMFilterEffHists<ProbeType> histColl_;
0066   std::string tagExtraFilter_;
0067   //really wondering whether to put an accessor to HLTDQMFilterEffHists for this
0068   //feels ineligant though so I made another copy here
0069   std::string hltProcess_;
0070 };
0071 
0072 #endif