test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 & );
28  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
29 
30 private:
31  virtual 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 }
57 
58 void
61  desc.add<edm::InputTag>("L1GtReadoutRecordTag",edm::InputTag("hltGtDigis"));
62  desc.add<bool>("invert",false);
63  descriptions.add("hltPhysicsDeclared",desc);
64 }
65 
67 {
68  bool accept = false;
69 
70  if (event.isRealData()) {
71  // for real data, access the "physics enabled" bit in the L1 GT data
73  if (not event.getByToken(m_gtDigisToken, h_gtDigis)) {
74  edm::LogWarning(h_gtDigis.whyFailed()->category()) << h_gtDigis.whyFailed()->what();
75  // not enough informations to make a decision - reject the event
76  return false;
77  } else {
78  L1GtFdlWord fdlWord = h_gtDigis->gtFdlWord();
79  if (fdlWord.physicsDeclared() == 1)
80  accept = true;
81  }
82  } else {
83  // for MC, assume the "physics enabled" bit to be always set
84  accept = true;
85  }
86 
87  // if requested, invert the filter decision
88  if (m_invert)
89  accept = not accept;
90 
91  return accept;
92 }
93 
94 // define this as a framework plug-in
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual bool filter(edm::Event &, const edm::EventSetup &) override
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
bool isRealData() const
Definition: EventBase.h:64
HLTPhysicsDeclared(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const cms_uint16_t physicsDeclared() const
get/set &quot;physics declared&quot; bit
Definition: L1GtFdlWord.h:227
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:110
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtDigisToken
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")