CMS 3D CMS Logo

HLTPhysicsDeclared.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTPhysicsDeclared
4 // Class: HLTPhysicsDeclared
5 //
6 // Original Author: Luca Malgeri
7 // Adapted for HLT by: Andrea Bocci
8 
9 // user include files
17 
20 //
21 // class declaration
22 //
23 
25 public:
26  explicit HLTPhysicsDeclared( const edm::ParameterSet & );
27  ~HLTPhysicsDeclared() override;
28  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
29 
30 private:
31  bool filter( edm::Event &, const edm::EventSetup & ) override;
32 
33  bool m_invert;
36 
37 };
38 
39 // system include files
40 #include <memory>
41 
42 // user include files
44 
45 using namespace edm;
46 
48  m_invert( config.getParameter<bool>("invert") ),
49  m_gtDigis( config.getParameter<edm::InputTag>("L1GtReadoutRecordTag") )
50 {
51  m_gtDigisToken = consumes<L1GlobalTriggerReadoutRecord>(m_gtDigis);
52 }
53 
55 
56 void
59  desc.add<edm::InputTag>("L1GtReadoutRecordTag",edm::InputTag("hltGtDigis"));
60  desc.add<bool>("invert",false);
61  descriptions.add("hltPhysicsDeclared",desc);
62 }
63 
65 {
66  bool accept = false;
67 
68  if (event.isRealData()) {
69  // for real data, access the "physics enabled" bit in the L1 GT data
71  if (not event.getByToken(m_gtDigisToken, h_gtDigis)) {
72  edm::LogWarning(h_gtDigis.whyFailed()->category()) << h_gtDigis.whyFailed()->what();
73  // not enough informations to make a decision - reject the event
74  return false;
75  } else {
76  L1GtFdlWord fdlWord = h_gtDigis->gtFdlWord();
77  if (fdlWord.physicsDeclared() == 1)
78  accept = true;
79  }
80  } else {
81  // for MC, assume the "physics enabled" bit to be always set
82  accept = true;
83  }
84 
85  // if requested, invert the filter decision
86  if (m_invert)
87  accept = not accept;
88 
89  return accept;
90 }
91 
92 // define this as a framework plug-in
~HLTPhysicsDeclared() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: config.py:1
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
bool isRealData() const
Definition: EventBase.h:62
HLTPhysicsDeclared(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:227
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:106
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtDigisToken
Definition: event.py:1