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_ = iConfig.getParameter<edm::InputTag> ("HLTriggerResults");
38  init_ = false;
39 }
40 
42 {
43 }
44 
46 {
47 
48  bool accepted = false;
49 
50  int ievt = iEvent.id().event();
51  int irun = iEvent.id().run();
52  int ils = iEvent.luminosityBlock();
53  int bx = iEvent.bunchCrossing();
54 
55 
56  //hlt info
58  iEvent.getByLabel(hlTriggerResults_,HLTR);
59 
60  if(HLTR.isValid())
61  {
62  if (!init_) {
63  init_=true;
64  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*HLTR);
65  hlNames_=triggerNames.triggerNames();
66  }
67  if(debugOn)
68  {
69  std::cout << "HLT_debug: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Acc: " ;
70  const unsigned int n(hlNames_.size());
71  for (unsigned int i=0; i!=n; ++i)
72  {
73  if (HLTR->accept(i))
74  {
75  std::cout << hlNames_[i] << ",";
76  }
77  }
78  std::cout << std::endl;
79  }
80 
81  }
82 
83  // trigger info
84 
86  iEvent.getByLabel("gtDigis", gtrr_handle);
87  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
88 
89  L1GtFdlWord fdlWord = gtrr->gtFdlWord();
90  // std::cout << "phys decl. bit=" << fdlWord.physicsDeclared() << std::endl;
91  if (fdlWord.physicsDeclared() ==1) accepted=true;
92 
93 
94  if (debugOn) {
95 
96  std::cout << "PhysDecl_debug: Run " << irun << " Event " << ievt << " Lumi Block " << ils << " Bunch Crossing " << bx << " Accepted " << accepted << std::endl;
97  }
98 
99  if (applyfilter)
100  return accepted;
101  else
102  return true;
103 
104 }
105 
106 //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:208
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
PhysDecl(const edm::ParameterSet &)
Definition: PhysDecl.cc:33
virtual bool filter(edm::Event &, const edm::EventSetup &) override
Definition: PhysDecl.cc:45
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
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:41
edm::EventID id() const
Definition: EventBase.h:60
tuple cout
Definition: gather_cfg.py:121