CMS 3D CMS Logo

HLTInspect.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: BeamSplash
4 // Class: BeamSPlash
5 //
6 //
7 // Original Author: Luca Malgeri
8 
9 #include <memory>
10 #include <vector>
11 #include <map>
12 #include <set>
13 
14 // user include files
16 
29 
30 using namespace edm;
31 using namespace std;
32 
34 {
35  hlTriggerResults_ = iConfig.getParameter<edm::InputTag> ("HLTriggerResults");
36  init_ = false;
37 }
38 
40 {
41 }
43 {
44 
45 
46  int ievt = iEvent.id().event();
47  int irun = iEvent.id().run();
48  int ils = iEvent.luminosityBlock();
49  int bx = iEvent.bunchCrossing();
50 //
51 // trigger type
52 //
53  int trigger_type=-1;
54  if (iEvent.isRealData()) trigger_type = iEvent.experimentType();
55 
56 
57  //hlt info
59  iEvent.getByLabel(hlTriggerResults_,HLTR);
60 
61 
62  if(HLTR.isValid() == false) {
63  std::cout<< " HLTInspect Error - Could not access Results with name "<<hlTriggerResults_<<std::endl;
64  }
65  if(HLTR.isValid())
66  {
67  if (!init_) {
68  init_=true;
69  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*HLTR);
70  hlNames_=triggerNames.triggerNames();
71  }
72  std::cout << "HLTInspect: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Type "<<trigger_type<< " Acc: " ;
73  const unsigned int n(hlNames_.size());
74  for (unsigned int i=0; i!=n; ++i)
75  {
76  if (HLTR->accept(i))
77  {
78  std::cout << hlNames_[i] << ",";
79  }
80  }
81  std::cout << std::endl;
82  }
83 
84 
85 }
86 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:234
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool accept() const
Has at least one path accepted the event?
int bunchCrossing() const
Definition: EventBase.h:64
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
bool isRealData() const
Definition: EventBase.h:62
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
int iEvent
Definition: GenABIO.cc:230
virtual void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: HLTInspect.cc:42
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
HLTInspect(const edm::ParameterSet &)
Definition: HLTInspect.cc:33
edm::EventID id() const
Definition: EventBase.h:58
HLT enums.
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:63