CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
35  applyfilter = iConfig.getUntrackedParameter<bool>("applyfilter",true);
36  debugOn = iConfig.getUntrackedParameter<bool>("debugOn",false);
37  hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag> ("HLTriggerResults"));
38  gtDigis_ = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getUntrackedParameter<edm::InputTag> ("gtDigis",edm::InputTag("gtDigis")));
39  init_ = false;
40 }
41 
43 {
44 }
45 
47 {
48 
49  bool accepted = false;
50 
51  int ievt = iEvent.id().event();
52  int irun = iEvent.id().run();
53  int ils = iEvent.luminosityBlock();
54  int bx = iEvent.bunchCrossing();
55 
56 
57  //hlt info
59  iEvent.getByToken(hlTriggerResults_,HLTR);
60 
61  if(HLTR.isValid())
62  {
63  if (!init_) {
64  init_=true;
65  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*HLTR);
66  hlNames_=triggerNames.triggerNames();
67  }
68  if(debugOn)
69  {
70  std::cout << "HLT_debug: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Acc: " ;
71  const unsigned int n(hlNames_.size());
72  for (unsigned int i=0; i!=n; ++i)
73  {
74  if (HLTR->accept(i))
75  {
76  std::cout << hlNames_[i] << ",";
77  }
78  }
79  std::cout << std::endl;
80  }
81 
82  }
83 
84  // trigger info
85 
87  iEvent.getByToken(gtDigis_, gtrr_handle);
88  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
89 
90  L1GtFdlWord fdlWord = gtrr->gtFdlWord();
91  // std::cout << "phys decl. bit=" << fdlWord.physicsDeclared() << std::endl;
92  if (fdlWord.physicsDeclared() ==1) accepted=true;
93 
94 
95  if (debugOn) {
96 
97  std::cout << "PhysDecl_debug: Run " << irun << " Event " << ievt << " Lumi Block " << ils << " Bunch Crossing " << bx << " Accepted " << accepted << std::endl;
98  }
99 
100  if (applyfilter)
101  return accepted;
102  else
103  return true;
104 
105 }
106 
107 //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
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:234
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int bunchCrossing() const
Definition: EventBase.h:64
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
PhysDecl(const edm::ParameterSet &)
Definition: PhysDecl.cc:33
virtual bool filter(edm::Event &, const edm::EventSetup &) override
Definition: PhysDecl.cc:46
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
const cms_uint16_t physicsDeclared() const
get/set &quot;physics declared&quot; bit
Definition: L1GtFdlWord.h:227
~PhysDecl()
Definition: PhysDecl.cc:42
edm::EventID id() const
Definition: EventBase.h:58
tuple cout
Definition: gather_cfg.py:145