CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1GtBeamModeFilter Class Reference

#include <L1GtBeamModeFilter.h>

Inheritance diagram for L1GtBeamModeFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 filter the event More...
 
 L1GtBeamModeFilter (const edm::ParameterSet &)
 constructor More...
 
 ~L1GtBeamModeFilter () override
 destructor More...
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< unsigned int > m_allowedBeamMode
 vector of beam modes (coded as integer numbers) More...
 
edm::InputTag m_condInEdmInputTag
 input tag for ConditionInEdm products More...
 
bool m_condInRunBlockValid
 valid ConditionsInRunBlock product More...
 
bool m_invertResult
 return the inverted result More...
 
bool m_isDebugEnabled
 cache edm::isDebugEnabled() More...
 
edm::InputTag m_l1GtEvmReadoutRecordTag
 InputTag for the L1 Global Trigger EVM readout record. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: filter according to the beam mode using the BST information received by L1 GT.

Implementation: This class is an EDFilter. It implements:

Author
: Vasile Mihai Ghete - HEPHY Vienna

Description: see class header.

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 37 of file L1GtBeamModeFilter.h.

Constructor & Destructor Documentation

L1GtBeamModeFilter::L1GtBeamModeFilter ( const edm::ParameterSet parSet)
explicit

constructor

Definition at line 38 of file L1GtBeamModeFilter.cc.

References LogDebug, LogTrace, m_allowedBeamMode, m_condInEdmInputTag, m_invertResult, m_isDebugEnabled, and m_l1GtEvmReadoutRecordTag.

38  :
39 
41  "CondInEdmInputTag")),
43  "L1GtEvmReadoutRecordTag")),
44  m_allowedBeamMode(parSet.getParameter<std::vector<unsigned int> >(
45  "AllowedBeamMode")),
46  m_invertResult(parSet.getParameter<bool>(
47  "InvertResult")),
49  m_condInRunBlockValid(false) {
50 
51  if (m_isDebugEnabled) {
52 
53  LogDebug("L1GtBeamModeFilter") << std::endl;
54 
55  LogTrace("L1GtBeamModeFilter")
56  << "\nInput tag for ConditionsInEdm product: "
58  << "\nInput tag for L1 GT EVM record: "
60  << "\nAllowed beam modes:"
61  << std::endl;
62 
63  for (std::vector<unsigned int>::const_iterator itMode =
64  m_allowedBeamMode.begin(); itMode != m_allowedBeamMode.end(); ++itMode) {
65 
66  LogTrace("L1GtBeamModeFilter") << " " << (*itMode) << std::endl;
67 
68  }
69 
70  LogTrace("L1GtBeamModeFilter")
71  << "\nInvert result (use as NOT filter): "
73  << std::endl;
74 
75  LogTrace("L1GtBeamModeFilter") << std::endl;
76 
77  }
78 }
#define LogDebug(id)
std::vector< unsigned int > m_allowedBeamMode
vector of beam modes (coded as integer numbers)
T getParameter(std::string const &) const
bool isDebugEnabled()
edm::InputTag m_l1GtEvmReadoutRecordTag
InputTag for the L1 Global Trigger EVM readout record.
bool m_condInRunBlockValid
valid ConditionsInRunBlock product
bool m_isDebugEnabled
cache edm::isDebugEnabled()
#define LogTrace(id)
bool m_invertResult
return the inverted result
edm::InputTag m_condInEdmInputTag
input tag for ConditionInEdm products
L1GtBeamModeFilter::~L1GtBeamModeFilter ( )
override

destructor

Definition at line 81 of file L1GtBeamModeFilter.cc.

81  {
82  // empty now
83 }

Member Function Documentation

bool L1GtBeamModeFilter::filter ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
override

filter the event

Definition at line 87 of file L1GtBeamModeFilter.cc.

References edm::ConditionsInRunBlock::beamMode, edm::Run::getByLabel(), edm::Event::getByLabel(), edm::Event::getRun(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), edm::EventBase::isRealData(), edm::HandleBase::isValid(), LogDebug, m_allowedBeamMode, m_condInEdmInputTag, m_condInRunBlockValid, m_invertResult, and m_l1GtEvmReadoutRecordTag.

88  {
89 
90  // initialize filter result
91  bool filterResult = false;
92 
93  // for MC samples, return always true (not even checking validity of L1GlobalTriggerEvmReadoutRecord)
94  // eventually, the BST information will be filled also in MC simulation to spare this check
95 
96  if (!(iEvent.isRealData())) {
97  //LogDebug("L1GtBeamModeFilter") << "\nRunning on MC sample."
98  // << "\nAll events are automatically selected, without testing the beam mode"
99  // << "\n" << std::endl;
100 
101  if (m_invertResult) {
102  return false;
103  } else {
104  return true;
105  }
106 
107  }
108 
109  // data
110 
111  // initialize beam mode value
112  boost::uint16_t beamModeValue = 0;
113 
114  // get Run Data - the same code can be run in beginRun, with getByLabel from edm::Run
115  // TODO should I cache the run/luminosity section? to be decided after moving beamMode to LumiBlock
116  const edm::Run& iRun = iEvent.getRun();
117 
118  // get ConditionsInRunBlock
120  iRun.getByLabel(m_condInEdmInputTag, condInRunBlock);
121 
122  if (!condInRunBlock.isValid()) {
123 
124  LogDebug("L1GtBeamModeFilter") << "\nConditionsInRunBlock with \n "
126  << "\nrequested in configuration, but not found in the event."
127  << "\n" << std::endl;
128 
129  m_condInRunBlockValid = false;
130 
131  } else {
132 
133  m_condInRunBlockValid = true;
134  beamModeValue = condInRunBlock->beamMode;
135 
136  }
137 
138  // fall through to L1GlobalTriggerEvmReadoutRecord if ConditionsInRunBlock
139  // not available
140  if (!m_condInRunBlockValid) {
141 
142  // get L1GlobalTriggerEvmReadoutRecord and beam mode
144  iEvent.getByLabel(m_l1GtEvmReadoutRecordTag, gtEvmReadoutRecord);
145 
146  if (!gtEvmReadoutRecord.isValid()) {
147  LogDebug("L1GtBeamModeFilter")
148  << "\nL1GlobalTriggerEvmReadoutRecord with input tag "
150  << "\nrequested in configuration, but not found in the event."
151  << std::endl;
152 
153  // both products are missing, return false for both normal and inverted result
154  return false;
155 
156  } else {
157 
158  beamModeValue = (gtEvmReadoutRecord->gtfeWord()).beamMode();
159 
160  }
161 
162  }
163 
164  LogDebug("L1GtBeamModeFilter") << "\nBeam mode: " << beamModeValue
165  << std::endl;
166 
167  for (std::vector<unsigned int>::const_iterator itMode =
168  m_allowedBeamMode.begin(); itMode != m_allowedBeamMode.end(); ++itMode) {
169 
170  if (beamModeValue == (*itMode)) {
171  filterResult = true;
172 
173  //LogTrace("L1GtBeamModeFilter") << "Event selected - beam mode: "
174  // << beamModeValue << "\n" << std::endl;
175 
176  break;
177 
178  }
179  }
180 
181  //
182 
183  if (m_invertResult) {
184  filterResult = !filterResult;
185  }
186 
187  return filterResult;
188 
189 }
#define LogDebug(id)
std::vector< unsigned int > m_allowedBeamMode
vector of beam modes (coded as integer numbers)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:280
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
edm::InputTag m_l1GtEvmReadoutRecordTag
InputTag for the L1 Global Trigger EVM readout record.
Run const & getRun() const
Definition: Event.cc:99
bool m_condInRunBlockValid
valid ConditionsInRunBlock product
bool isRealData() const
Definition: EventBase.h:62
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
bool m_invertResult
return the inverted result
edm::InputTag m_condInEdmInputTag
input tag for ConditionInEdm products
Definition: Run.h:45

Member Data Documentation

std::vector<unsigned int> L1GtBeamModeFilter::m_allowedBeamMode
private

vector of beam modes (coded as integer numbers)

Definition at line 59 of file L1GtBeamModeFilter.h.

Referenced by filter(), and L1GtBeamModeFilter().

edm::InputTag L1GtBeamModeFilter::m_condInEdmInputTag
private

input tag for ConditionInEdm products

Definition at line 53 of file L1GtBeamModeFilter.h.

Referenced by filter(), and L1GtBeamModeFilter().

bool L1GtBeamModeFilter::m_condInRunBlockValid
private

valid ConditionsInRunBlock product

Definition at line 68 of file L1GtBeamModeFilter.h.

Referenced by filter().

bool L1GtBeamModeFilter::m_invertResult
private

return the inverted result

Definition at line 62 of file L1GtBeamModeFilter.h.

Referenced by filter(), and L1GtBeamModeFilter().

bool L1GtBeamModeFilter::m_isDebugEnabled
private

cache edm::isDebugEnabled()

Definition at line 65 of file L1GtBeamModeFilter.h.

Referenced by L1GtBeamModeFilter().

edm::InputTag L1GtBeamModeFilter::m_l1GtEvmReadoutRecordTag
private

InputTag for the L1 Global Trigger EVM readout record.

Definition at line 56 of file L1GtBeamModeFilter.h.

Referenced by filter(), and L1GtBeamModeFilter().