CMS 3D CMS Logo

PhysDecl.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  applyfilter = iConfig.getUntrackedParameter<bool>("applyfilter", true);
35  debugOn = iConfig.getUntrackedParameter<bool>("debugOn", false);
36  hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag>("HLTriggerResults"));
37  gtDigis_ = consumes<L1GlobalTriggerReadoutRecord>(
38  iConfig.getUntrackedParameter<edm::InputTag>("gtDigis", edm::InputTag("gtDigis")));
39  init_ = false;
40 }
41 
43 
45  bool accepted = false;
46 
47  int ievt = iEvent.id().event();
48  int irun = iEvent.id().run();
49  int ils = iEvent.luminosityBlock();
50  int bx = iEvent.bunchCrossing();
51 
52  //hlt info
54  iEvent.getByToken(hlTriggerResults_, HLTR);
55 
56  if (HLTR.isValid()) {
57  if (!init_) {
58  init_ = true;
59  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*HLTR);
60  hlNames_ = triggerNames.triggerNames();
61  }
62  if (debugOn) {
63  std::cout << "HLT_debug: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Acc: ";
64  const unsigned int n(hlNames_.size());
65  for (unsigned int i = 0; i != n; ++i) {
66  if (HLTR->accept(i)) {
67  std::cout << hlNames_[i] << ",";
68  }
69  }
70  std::cout << std::endl;
71  }
72  }
73 
74  // trigger info
75 
77  iEvent.getByToken(gtDigis_, gtrr_handle);
78  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
79 
80  L1GtFdlWord fdlWord = gtrr->gtFdlWord();
81  // std::cout << "phys decl. bit=" << fdlWord.physicsDeclared() << std::endl;
82  if (fdlWord.physicsDeclared() == 1)
83  accepted = true;
84 
85  if (debugOn) {
86  std::cout << "PhysDecl_debug: Run " << irun << " Event " << ievt << " Lumi Block " << ils << " Bunch Crossing "
87  << bx << " Accepted " << accepted << std::endl;
88  }
89 
90  if (applyfilter)
91  return accepted;
92  else
93  return true;
94 }
95 
96 //define this as a plug-in
bool accept() const
Has at least one path accepted the event?
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:169
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
T const * product() const
Definition: Handle.h:70
PhysDecl(const edm::ParameterSet &)
Definition: PhysDecl.cc:33
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: PhysDecl.cc:44
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
~PhysDecl() override
Definition: PhysDecl.cc:42
bool isValid() const
Definition: HandleBase.h:70
HLT enums.