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 
28 
29 using namespace edm;
30 using namespace std;
31 
33  applyfilter = iConfig.getUntrackedParameter<bool>("applyfilter", true);
34  debugOn = iConfig.getUntrackedParameter<bool>("debugOn", false);
35  hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag>("HLTriggerResults"));
36  gtDigis_ = consumes<L1GlobalTriggerReadoutRecord>(
37  iConfig.getUntrackedParameter<edm::InputTag>("gtDigis", edm::InputTag("gtDigis")));
38  init_ = false;
39 }
40 
42 
44  bool accepted = false;
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  //hlt info
53  iEvent.getByToken(hlTriggerResults_, HLTR);
54 
55  if (HLTR.isValid()) {
56  if (!init_) {
57  init_ = true;
58  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*HLTR);
59  hlNames_ = triggerNames.triggerNames();
60  }
61  if (debugOn) {
62  std::cout << "HLT_debug: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Acc: ";
63  const unsigned int n(hlNames_.size());
64  for (unsigned int i = 0; i != n; ++i) {
65  if (HLTR->accept(i)) {
66  std::cout << hlNames_[i] << ",";
67  }
68  }
69  std::cout << std::endl;
70  }
71  }
72 
73  // trigger info
74 
76  iEvent.getByToken(gtDigis_, gtrr_handle);
77  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
78 
79  L1GtFdlWord fdlWord = gtrr->gtFdlWord();
80  // std::cout << "phys decl. bit=" << fdlWord.physicsDeclared() << std::endl;
81  if (fdlWord.physicsDeclared() == 1)
82  accepted = true;
83 
84  if (debugOn) {
85  std::cout << "PhysDecl_debug: Run " << irun << " Event " << ievt << " Lumi Block " << ils << " Bunch Crossing "
86  << bx << " Accepted " << accepted << std::endl;
87  }
88 
89  if (applyfilter)
90  return accepted;
91  else
92  return true;
93 }
94 
95 //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:307
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:169
applyfilter
Definition: DMR_cfg.py:138
T const * product() const
Definition: Handle.h:70
PhysDecl(const edm::ParameterSet &)
Definition: PhysDecl.cc:32
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: PhysDecl.cc:43
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~PhysDecl() override
Definition: PhysDecl.cc:41
bool isValid() const
Definition: HandleBase.h:70
HLT enums.