CMS 3D CMS Logo

TrigObjTnPSource.cc
Go to the documentation of this file.
1 
11 
12 #include "TrigObjTnPHistColl.h"
13 
14 
15 
16 class TrigObjTnPSource : public DQMGlobalEDAnalyzer<std::vector<TrigObjTnPHistColl> > {
17 public:
18  explicit TrigObjTnPSource(const edm::ParameterSet&);
19  ~TrigObjTnPSource() override = default;
20  TrigObjTnPSource(const TrigObjTnPSource&) = delete;
21  TrigObjTnPSource& operator=(const TrigObjTnPSource&) = delete;
22 
23  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
24 
25  void dqmAnalyze(const edm::Event&, const edm::EventSetup&, const std::vector<TrigObjTnPHistColl>&)const override;
26  void bookHistograms(DQMStore::ConcurrentBooker&, const edm::Run&, const edm::EventSetup& ,std::vector<TrigObjTnPHistColl>&) const override;
27  void dqmBeginRun(const edm::Run&, const edm::EventSetup&, std::vector<TrigObjTnPHistColl>&) const override;
28 
29 private:
33  //it would be more memory efficient to save this as a vector of TrigTnPHistColls and then use this to instance
34  //the TrigTnPHistColls for each run, something to do for the future
35  std::vector<edm::ParameterSet> histCollConfigs_;
36 
37 };
38 
40  trigEvtToken_(consumes<trigger::TriggerEvent>(config.getParameter<edm::InputTag>("triggerEvent"))),
41  trigResultsToken_(consumes<edm::TriggerResults>(config.getParameter<edm::InputTag>("triggerResults"))),
42  hltProcess_(config.getParameter<edm::InputTag>("triggerResults").process()),
43  histCollConfigs_(config.getParameter<std::vector<edm::ParameterSet>>("histColls"))
44 {
45 
46 }
47 
48 
50 {
52  desc.add<edm::InputTag>("triggerEvent", edm::InputTag("hltTriggerSummaryAOD::HLT"));
53  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults::HLT"));
54  desc.addVPSet("histColls",
56  std::vector<edm::ParameterSet>());
57  descriptions.add("trigObjTnPSource",desc);
58 }
59 
61  const edm::EventSetup& setup,
62  std::vector<TrigObjTnPHistColl>& tnpHistColls)const
63 {
64  tnpHistColls.clear();
65  HLTConfigProvider hltConfig;
66  bool hltChanged=false;
67  hltConfig.init(run, setup, hltProcess_, hltChanged);
68  for(auto& histCollConfig : histCollConfigs_) tnpHistColls.emplace_back(TrigObjTnPHistColl(histCollConfig));
69  for(auto& histColl : tnpHistColls){
70  histColl.init(hltConfig);
71  histColl.bookHists(iBooker);
72  }
73 }
74 
75 void TrigObjTnPSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup& setup, std::vector<TrigObjTnPHistColl>& tnpHistColls) const
76 {
77 
78 }
79 
81  const std::vector<TrigObjTnPHistColl>& tnpHistColls)const
82 {
84  event.getByToken(trigEvtToken_,trigEvtHandle);
85  edm::Handle<edm::TriggerResults> trigResultsHandle;
86  event.getByToken(trigResultsToken_,trigResultsHandle);
87  //DQM should never crash the HLT under any circumstances (except at configure)
88  if(trigEvtHandle.isValid() && trigResultsHandle.isValid()){
89  for(auto& histColl: tnpHistColls){
90  histColl.fill(*trigEvtHandle,*trigResultsHandle,
91  event.triggerNames(*trigResultsHandle));
92  }
93  }
94 }
95 
TrigObjTnPSource(const edm::ParameterSet &)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
std::vector< edm::ParameterSet > histCollConfigs_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void dqmBeginRun(const edm::Run &, const edm::EventSetup &, std::vector< TrigObjTnPHistColl > &) const override
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
Definition: config.py:1
TrigObjTnPSource & operator=(const TrigObjTnPSource &)=delete
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static edm::ParameterSetDescription makePSetDescription()
edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
~TrigObjTnPSource() override=default
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string hltProcess_
HLT enums.
void bookHistograms(DQMStore::ConcurrentBooker &, const edm::Run &, const edm::EventSetup &, std::vector< TrigObjTnPHistColl > &) const override
void dqmAnalyze(const edm::Event &, const edm::EventSetup &, const std::vector< TrigObjTnPHistColl > &) const override
edm::EDGetTokenT< trigger::TriggerEvent > trigEvtToken_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:301
Definition: event.py:1
Definition: Run.h:44